summaryrefslogtreecommitdiff
path: root/compiler/simplCore/CSE.hs
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2020-02-06 15:11:21 +0100
committerAndreas Klebinger <klebinger.andreas@gmx.at>2020-02-06 17:04:27 +0100
commitc2886bf608b283ce9034a1cf5ad854b8b9286b5e (patch)
treee85ac268370530d7018f992d3bd3fb5ddf767ecc /compiler/simplCore/CSE.hs
parent5e63d9c07c0585b85c8fa340d30aeff0130af3f4 (diff)
downloadhaskell-wip/andreask/T17724.tar.gz
Fix #17724 by running the simplifier before late CSEwip/andreask/T17724
CSE seems to depend on bindings being in dependency order. The simplifier put's bindings into dependency order. So do a simplifier run first. We used to do in order * ... * optional: late spec + simplifier "post-late-spec" run * optional: late cse * simplifier "final" run * ... We now do: * ... * optional: late spec * optional: simplifier "pre-late-cse" run + cse * simplifier "final" run. * ... The result is that: * At -O we now potentially do fewer runs of the simplifier. "post-late-spec" is gone if late-spec is on * At -O2 we do an additional simplifier run : "pre-late-cse" * At -O2 with -fspec-late we do what we already did. Only that the intermediate simplifier run is called "pre-late-cse" instead of "post-late-spec". We also removed a case where occAnal dropped code it assumed to be dead.
Diffstat (limited to 'compiler/simplCore/CSE.hs')
-rw-r--r--compiler/simplCore/CSE.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs
index 9a0945e290..0835f87bb0 100644
--- a/compiler/simplCore/CSE.hs
+++ b/compiler/simplCore/CSE.hs
@@ -327,6 +327,7 @@ the program; it's a kind of synthetic key for recursive bindings.
************************************************************************
-}
+-- | Requires bindings to be in dependency order.
cseProgram :: CoreProgram -> CoreProgram
cseProgram binds = snd (mapAccumL (cseBind TopLevel) emptyCSEnv binds)