[PATCH] D63972: [CodeGen] Do the Simple Early Return in block-placement pass to optimize the blocks

Zhang Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 21:53:52 PDT 2019


ZhangKang added a comment.

In D63972#1605006 <https://reviews.llvm.org/D63972#1605006>, @efriedma wrote:

> You probably want `F->erase(TBB)`, which both removes TBB from the list of blocks in the function, and deallocates TBB.  I guess the empty block with no predecessors doesn't really matter much, in the long run, but easier to understand if the transform cleans up after itself properly.


Yes, the empty block with no predecessors doesn't really matter much. Here, if I use `F->erase(TBB)`, the memory leak error is still existed.
`BlockToChain` is the map which contain all BB.
In `MachineBlockPlacement::maybeTailDuplicateBlock()`, there is similar code to remove the BB.

  2933         // Remove from the Chain and Chain Map
  2934         if (BlockToChain.count(RemBB)) {
                      ...
  2937           Chain->remove(RemBB);
  2938           BlockToChain.erase(RemBB);
  2939         }
  2940


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63972/new/

https://reviews.llvm.org/D63972





More information about the llvm-commits mailing list