#4448: Another case of SpecConstr not specialising
---------------------------------+------------------------------------------
    Reporter:  rl                |        Owner:                         
        Type:  bug               |       Status:  new                    
    Priority:  normal            |    Milestone:  7.0.2                  
   Component:  Compiler          |      Version:  7.1                    
    Keywords:                    |     Testcase:                         
   Blockedby:                    |   Difficulty:                         
          Os:  Unknown/Multiple  |     Blocking:                         
Architecture:  Unknown/Multiple  |      Failure:  Runtime performance bug
---------------------------------+------------------------------------------

Comment(by simonpj):

 Nice example! The reason for this turns out to be simple.  !SpecConstr
 specialises a function `f` when
  * It sees a call to `f (I# x, I# y)`
  * AND it can see that `f` takes apart the pair, and takes apart the first
 `Int`, and takes apart the second `Int`.
 The second condition is to avoid over-specialising (see the
 [http://research.microsoft.com/~simonpj/papers/spec-constr/index.htm
 original paper]).  The "taking apart" analysis is fiarly simple-minded,
 and it fails in this example, because one of the arguments is passed on
 (un-take-apart) to a recursive call, and ''that'' takes it apart.

 One solution is presumably to use `ForceSpecConstr` on this loop?
 (Another would be to use a more sophisticated analysis.)

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