• simonpj@microsoft.com's avatar
    Improve optimisation of cost centres · e0419565
    simonpj@microsoft.com authored
    This patch fixes test failures for the profiling way for drv001.
    The problem was that the arity of a function was decreasing during
    "optimisation" because of interaction with SCC annotations.
    In particular
          f = /\a. scc "f" (h x)    -- where h had arity 2
    and h gets inlined, led to
          f = /\a. scc "f" let v = scc "f" x in \y. <blah>
    
    Two main changes:
    
    1.  exprIsTrivial now says True for (scc "f" x)
        See Note [SCCs are trivial] in CoreUtils
    
    2.  The simplifier eliminates nested pushing of the same cost centre:
      	scc "f" (...(scc "f" e)...) 
      	==>  scc "f" (...e...)
    
    
    e0419565
Simplify.lhs 86.3 KB