
Consider the following code data Data = Data { unData :: !Int } func :: Data -> Int func x = case unData x of 1 -> 2 _ -> 0 Compiling with GHC 6.8.2 gives the following stg code Main.func = \r [x_slg] case x_slg of tpl_slx { Main.Data ipv_slj -> case ipv_slj of wild_sly { GHC.Base.I# ds_slm -> case ds_slm of ds1_slz { __DEFAULT -> Main.lvl1; 1 -> Main.lvl; }; }; }; The native code generator turns it into the following x86_64 assembler Main_func_info: leaq -8(%rbp),%rax cmpq %r14,%rax jb .LcnU movq %rsi,%rbx movq $sni_info,-8(%rbp) addq $-8,%rbp testq $7,%rbx jne sni_info jmp *(%rbx) .LcnU: movl $Main_func_closure,%ebx jmp *-8(%r13) sni_info: movq 7(%rbx),%rbx movq $snj_info,(%rbp) testq $7,%rbx jne snj_info jmp *(%rbx) snj_info: cmpq $1,7(%rbx) jne .LcnE movl $Main_lvl_closure+1,%ebx addq $8,%rbp jmp *(%rbp) .LcnE: movl $Main_lvl1_closure+1,%ebx addq $8,%rbp jmp *(%rbp) It seems to me that the !Int member of the Data constructor is being treated like it might be a thunk in sni_info (i.e., the whole "testq $7,%rbx" thing). Isn't this unnecessary as the "!" strictness flag means the Int argument must be forced by the Data constructor before being captured? Thanks! -Tyson