Superfluous seq no eliminated
Program:
foo :: Int -> Int
foo 0 = 0
foo n = (if n < 5 then 1 else 2) `seq` foo (n-1)
GHC generates this code:
T.$wfoo =
\ (ww_slm :: GHC.Prim.Int#) ->
case ww_slm of ds_XkE {
__DEFAULT ->
case case GHC.Prim.<# ds_XkE 5 of _ {
GHC.Bool.False -> lvl1_rlG; GHC.Bool.True -> lvl_rlE
}
of _ { __DEFAULT ->
T.$wfoo (GHC.Prim.-# ds_XkE 1)
};
0 -> 0
}
Note that the seq is still there although it is a nop. This actually occurs in stream fusion code.
Trac metadata
Trac field | Value |
---|---|
Version | 6.13 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |