summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-03-07 15:02:34 +0000
committerSimon Marlow <marlowsd@gmail.com>2012-03-07 15:02:34 +0000
commite2ee3344ffbb5057eb503f150b8ef5f52cd9ef26 (patch)
treefd007cc7f274907f2cdfb9244aceac1f728faad7 /compiler
parente85a8771e657d5f62336ff72e256e0d11346c14b (diff)
downloadhaskell-e2ee3344ffbb5057eb503f150b8ef5f52cd9ef26.tar.gz
Fix a bug in common block elimination
When we had more than two identical blocks, we weren't eliminating all the duplicates properly.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmm/CmmCommonBlockElim.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/cmm/CmmCommonBlockElim.hs b/compiler/cmm/CmmCommonBlockElim.hs
index 9b484f9679..9355a09534 100644
--- a/compiler/cmm/CmmCommonBlockElim.hs
+++ b/compiler/cmm/CmmCommonBlockElim.hs
@@ -69,10 +69,11 @@ common_block (old_change, bmap, subst) (hash, b) =
mapLookup bid subst) of
(Just b', Nothing) -> addSubst b'
(Just b', Just b'') | entryLabel b' /= b'' -> addSubst b'
+ | otherwise -> (old_change, bmap, subst)
_ -> (old_change, addToUFM bmap hash (b : bs), subst)
Nothing -> (old_change, addToUFM bmap hash [b], subst)
where bid = entryLabel b
- addSubst b' = my_trace "found new common block" (ppr (entryLabel b')) $
+ addSubst b' = my_trace "found new common block" (ppr bid <> char '=' <> ppr (entryLabel b')) $
(True, bmap, mapInsert bid (entryLabel b') subst)