Commit e2ee3344 authored by Simon Marlow's avatar Simon Marlow

Fix a bug in common block elimination

When we had more than two identical blocks, we weren't eliminating all
the duplicates properly.
parent e85a8771
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment