#4431: SpecConstr doesn't specialise
---------------------------------+------------------------------------------
    Reporter:  rl                |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Component:  Compiler               
     Version:  7.1               |    Keywords:                         
    Testcase:                    |   Blockedby:                         
          Os:  Unknown/Multiple  |    Blocking:                         
Architecture:  Unknown/Multiple  |     Failure:  Runtime performance bug
---------------------------------+------------------------------------------
 Compile this with `-O2 -fno-spec-constr-count`:

 {{{
 foo :: Int -> Int -> Bool
 foo n x = loop 0 False (Just x)
   where
     loop i b x | i > n = b
     loop i False x = loop (i+1) True x
     loop i True (Just x) = loop (i+1) False Nothing
     loop i True Nothing  = loop (i+1) True (Just x)
 }}}

 !SpecConstr produces a loop of type `Maybe Int -> Int# -> Bool`, i.e., it
 doesn't specialise for the `Maybe` argument for some reason.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4431>
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