#3717: Superfluous seq no eliminated
---------------------------------+------------------------------------------
    Reporter:  rl                |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Component:  Compiler               
     Version:  6.13              |    Keywords:                         
          Os:  Unknown/Multiple  |    Testcase:                         
Architecture:  Unknown/Multiple  |     Failure:  Runtime performance bug
---------------------------------+------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3717>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to