Simon Jakobi pushed to branch wip/sjakobi/cbe-delete-losers at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Cmm/CommonBlockElim.hs
    ... ... @@ -64,7 +64,7 @@ elimCommonBlocks :: CmmGraph -> CmmGraph
    64 64
     elimCommonBlocks g =
    
    65 65
         assert (g_entry g == g_entry g') g'
    
    66 66
       where
    
    67
    -     g' = replaceLabels env $ copyTicks env g
    
    67
    +     g' = replaceLabels env $ dropEliminatedBlocks env $ copyTicks env g
    
    68 68
          env = iterate mapEmpty blocks_with_key
    
    69 69
          blocks_with_key = [ [ (successors b, [b]) | b <- bs] | bs <- groups]
    
    70 70
          groups = groupByInt hash_block candidates :: [[CmmBlock]]
    
    ... ... @@ -322,6 +322,12 @@ copyTicks env g
    322 322
               in CmmEntry lbl (combineTickScopes scp0 scp1) `blockJoinHead`
    
    323 323
                  foldr blockCons code (map CmmTick ticks)
    
    324 324
     
    
    325
    +-- | Remove the blocks eliminated by the substitution from the graph.
    
    326
    +dropEliminatedBlocks :: Subst -> CmmGraph -> CmmGraph
    
    327
    +dropEliminatedBlocks env g
    
    328
    +  | mapNull env = g
    
    329
    +  | otherwise   = ofBlockMap (g_entry g) (toBlockMap g `mapDifference` env)
    
    330
    +
    
    325 331
     -- Group by [Label]
    
    326 332
     -- See Note [Compressed TrieMap] in GHC.Core.Map.Expr about the usage of GenMap.
    
    327 333
     groupByLabel :: [(Key, DistinctBlocks)] -> [(Key, NonEmpty DistinctBlocks)]