Skip to content

Opportunity to improve CSE

In nofib/spectral/mandel2, the function check_perim calls point_colour on various arguments. After inlining point_colour there is the opportunity to CSE among the sub-expressions the inlinings create.

In GHC 7.6, the join point didn't have a "one-shot" flag, so the full laziness pass floated these sub-expressions out, and they got CSEd.

As part of Ilya's new demand analyser changes, we get the "one-shot" flag right, so don't MFE those sub-expressions, so they aren't CSEd. As a result, allocation on mandel2 increases slightly (4.2%).

The solution is, I think, to do something a bit like like CorePrep before CSE. At the moment if we have

case f (I# y) of { (a,b) ->
case g (I# y) of { (p,q) -> ... }}

we stuipdly don't CSE that (I# y) even though it is manifestly sharable. Somehow we should.

Trac metadata
Trac field Value
Version 7.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information