#4945: Another SpecConstr infelicity
---------------------------------+------------------------------------------
    Reporter:  batterseapower    |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Component:  Compiler               
     Version:  7.0.1             |    Keywords:                         
    Testcase:                    |   Blockedby:                         
          Os:  Unknown/Multiple  |    Blocking:                         
Architecture:  Unknown/Multiple  |     Failure:  Runtime performance bug
---------------------------------+------------------------------------------

Comment(by batterseapower):

 OK, I got it. All you need to do is replace varUsage with:

 {{{
 varUsage :: ScEnv -> OutVar -> ArgOcc -> ScUsage
 varUsage env v use = case lookupHowBound env v of
     Just RecArg -> SCU { scu_calls = emptyVarEnv
                        , scu_occs = unitVarEnv v use }
     Just RecFun -> SCU { scu_calls = unitVarEnv v [(emptyVarEnv, [])] --
 Added so we get specialisations even if function used in trivial way (i.e.
 as a variable)
                        , scu_occs = emptyVarEnv }
     Nothing -> nullUsage
 }}}

 Otherwise the pattern guard on (lookupVarEnv bind_calls fn) in specialise
 fails, so we don't even get to call callsToPats.

 I think this is the right change, because it should also mean that we get
 call pattern specialisations for locally-bound functions that are e.g.
 stored inside a data structure.

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