summaryrefslogtreecommitdiff
path: root/compiler/utils/GraphOps.hs
diff options
context:
space:
mode:
authorBen.Lippmeier@anu.edu.au <unknown>2007-09-17 12:42:41 +0000
committerBen.Lippmeier@anu.edu.au <unknown>2007-09-17 12:42:41 +0000
commit6a347ffc34c0ded44c213e2a0217477f7b8196b9 (patch)
tree78c449286d6e842b27a1568acf2da56f123d8262 /compiler/utils/GraphOps.hs
parent1116b8749571c660d446258481e4e74798bbb864 (diff)
downloadhaskell-6a347ffc34c0ded44c213e2a0217477f7b8196b9.tar.gz
Bugfix to iterative coalescer
Coalescences must be applied to the unsimplified graph in the same order they were found by the iterative coalescing algorithm - otherwise the vreg rewrite mapping will be wrong and badness will ensue.
Diffstat (limited to 'compiler/utils/GraphOps.hs')
-rw-r--r--compiler/utils/GraphOps.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/utils/GraphOps.hs b/compiler/utils/GraphOps.hs
index ad5e18f3c0..972dd0769f 100644
--- a/compiler/utils/GraphOps.hs
+++ b/compiler/utils/GraphOps.hs
@@ -273,7 +273,9 @@ coalesceGraph
-- less colorable (aggressive coalescing)
-> Triv k cls color
-> Graph k cls color
- -> (Graph k cls color, [(k, k)])
+ -> ( Graph k cls color
+ , [(k, k)]) -- pairs of nodes that were coalesced, in the order that the
+ -- coalescing was applied.
coalesceGraph aggressive triv graph
= coalesceGraph' aggressive triv graph []
@@ -301,8 +303,8 @@ coalesceGraph' aggressive triv graph kkPairsAcc
-- keep running until there are no more coalesces can be found
in case catMaybes mPairs of
- [] -> (graph', kkPairsAcc)
- pairs -> coalesceGraph' aggressive triv graph' (pairs ++ kkPairsAcc)
+ [] -> (graph', reverse kkPairsAcc)
+ pairs -> coalesceGraph' aggressive triv graph' (reverse pairs ++ kkPairsAcc)
-- | Coalesce this pair of nodes unconditionally / agressively.