[commit: ghc] newcg: Fix a bug in common block elimination (e2ee334)

Simon Marlow marlowsd at gmail.com
Wed Mar 7 16:08:23 CET 2012


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : newcg

http://hackage.haskell.org/trac/ghc/changeset/e2ee3344ffbb5057eb503f150b8ef5f52cd9ef26

>---------------------------------------------------------------

commit e2ee3344ffbb5057eb503f150b8ef5f52cd9ef26
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Wed Mar 7 15:02:34 2012 +0000

    Fix a bug in common block elimination
    
    When we had more than two identical blocks, we weren't eliminating all
    the duplicates properly.

>---------------------------------------------------------------

 compiler/cmm/CmmCommonBlockElim.hs |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/compiler/cmm/CmmCommonBlockElim.hs b/compiler/cmm/CmmCommonBlockElim.hs
index 9b484f9..9355a09 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)
 
 





More information about the Cvs-ghc mailing list