[commit: ghc] master: Remove unnecessary check in CmmContFlowOpt (29db17f)

git at git.haskell.org git at git.haskell.org
Thu Oct 24 15:02:41 UTC 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/29db17fe02786a0af543e0f6de1d4ee4cca7e299/ghc

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

commit 29db17fe02786a0af543e0f6de1d4ee4cca7e299
Author: Jan Stolarek <jan.stolarek at p.lodz.pl>
Date:   Thu Oct 24 15:27:39 2013 +0200

    Remove unnecessary check in CmmContFlowOpt
    
    Fixes #8456


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

29db17fe02786a0af543e0f6de1d4ee4cca7e299
 compiler/cmm/CmmContFlowOpt.hs |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/compiler/cmm/CmmContFlowOpt.hs b/compiler/cmm/CmmContFlowOpt.hs
index 7a008e2..343aa59 100644
--- a/compiler/cmm/CmmContFlowOpt.hs
+++ b/compiler/cmm/CmmContFlowOpt.hs
@@ -198,9 +198,8 @@ blockConcat splitting_procs g at CmmGraph { g_entry = entry_id }
      maybe_concat block (blocks, shortcut_map, backEdges)
         -- If:
         --   (1) current block ends with unconditional branch to b' and
-        --   (2) it has exactly one predecessor (namely, current block) and
-        --   (3) we have not mapped any other label to b'
-        --       (see Note [Shortcut call returns]).
+        --   (2) it has exactly one predecessor (namely, current block)
+        --
         -- Then:
         --   (1) append b' block at the end of current block
         --   (2) remove b' from the map of blocks
@@ -211,10 +210,12 @@ blockConcat splitting_procs g at CmmGraph { g_entry = entry_id }
         -- shorcutable and has only one predecessor and attempted to shortcut it
         -- first we would make that block unreachable but would not remove it
         -- from the graph.
+        --
+        -- Note that we always maintain an up-to-date list of predecessors, so
+        -- we can ignore the contents of shortcut_map
         | CmmBranch b' <- last
-        , Just blk' <- mapLookup b' blocks
         , hasOnePredecessor b'
-        , hasNotBeenMappedTo b' shortcut_map
+        , Just blk' <- mapLookup b' blocks
         = let bid' = entryLabel blk'
           in ( mapDelete bid' $ mapInsert bid (splice head blk') blocks
              , shortcut_map
@@ -315,9 +316,6 @@ blockConcat splitting_procs g at CmmGraph { g_entry = entry_id }
 
           hasOnePredecessor b = numPreds b == 1
 
-          hasNotBeenMappedTo :: BlockId -> BlockEnv BlockId -> Bool
-          hasNotBeenMappedTo b successor_map = mapMember b successor_map
-
 -- Functions for incrementing and decrementing number of predecessors. If
 -- decrementing would set the predecessor count to 0, we remove entry from the
 -- map.



More information about the ghc-commits mailing list