Improve optimisation of cost centres
authorsimonpj@microsoft.com <unknown>
Fri, 11 Sep 2009 11:56:30 +0000 (11:56 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 11 Sep 2009 11:56:30 +0000 (11:56 +0000)
commite04195659aa59e83af80790c0179dd87e956a8b6
tree23a750b6eb136f917733ebea7f56135e60f0a91b
parent7d73a107dcdc2ff5141751d8352207ee8415d1ec
Improve optimisation of cost centres

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...)
compiler/coreSyn/CoreUtils.lhs
compiler/profiling/CostCentre.lhs
compiler/simplCore/Simplify.lhs