#4448: Another case of SpecConstr not specialising
---------------------------------+------------------------------------------
    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 with -O2 -fno-spec-constr-count -fno-spec-constr-threshold:

 {{{
 foo :: Int -> Int -> Int -> (Int,Int)
 foo !a !b !c = loop (Left (a,b))
   where
     loop :: Either (Int,Int) (Int, (Int,Int)) -> (Int,Int)
     loop (Left (!x,!n))
       | n > 0     = loop (Right (x,(x+c,n-1)))
       | otherwise = (x,n)

     loop (Right (i,t))
       | i < c     = loop (Right (i+1,t))
       | otherwise = loop (Left t)
 }}}

 !SpecConstr doesn't specialise for the `(Int,Int)` pair. Unless I'm
 mistaken, the !SpecConstr loop should get this since the call in `foo` has
 the form `Left (I# x, I# y)` and the pair then gets threaded through the
 loop.

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

Reply via email to