Better CSE optimisation
|Reported by:||simonmar||Owned by:||michalt|
|Type of failure:||None/Unknown||Test Case:||N/A|
|Related Tickets:||Differential Revisions:|
GHC's CSE optimisation is pretty weedy. It looks for expressions like this:
let x = e1 in e2
and replaces all occurrences of e1 in e2 with x. This doesn't do full CSE, but it does catch some cases. There have been case where full CSE would be significantly beneficial, though.
One possible way forward is to have a separate CSE pass that transformed expressions containing common subexpressions into the let-form above, and let the existing CSE pass do the final replacement.
We must be cautious, though: increasing sharing can introduce space leaks. Sometimes we can prove that this cannot happen, for example when the shared object is primitive, or has a bounded size.
Change History (14)
comment:7 Changed 6 years ago by simonmar
- difficulty changed from Difficult (1 week) to Difficult (2-5 days)
comment:8 Changed 5 years ago by SamAnklesaria
- Owner set to SamAnklesaria
- Type of failure set to None/Unknown