[PATCH] D32308: Use BasicBlock Util SplitBlock interface to update DT

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 13:46:15 PDT 2017


davidxl created this revision.

This fixed a bug in CodeExtractor that is only exposed with the partial inliner improvement patch (thus no test yet)


https://reviews.llvm.org/D32308

Files:
  lib/Transforms/Utils/CodeExtractor.cpp


Index: lib/Transforms/Utils/CodeExtractor.cpp
===================================================================
--- lib/Transforms/Utils/CodeExtractor.cpp
+++ lib/Transforms/Utils/CodeExtractor.cpp
@@ -218,22 +218,17 @@
   // containing PHI nodes merging values from outside of the region, and a
   // second that contains all of the code for the block and merges back any
   // incoming values from inside of the region.
-  BasicBlock::iterator AfterPHIs = Header->getFirstNonPHI()->getIterator();
-  BasicBlock *NewBB = Header->splitBasicBlock(AfterPHIs,
-                                              Header->getName()+".ce");
+  BasicBlock::iterator AfterPHIs;
+
+  BasicBlock *NewBB = llvm::SplitBlock(Header, Header->getFirstNonPHI(), DT);
 
   // We only want to code extract the second block now, and it becomes the new
   // header of the region.
   BasicBlock *OldPred = Header;
   Blocks.remove(OldPred);
   Blocks.insert(NewBB);
   Header = NewBB;
 
-  // Okay, update dominator sets. The blocks that dominate the new one are the
-  // blocks that dominate TIBB plus the new block itself.
-  if (DT)
-    DT->splitBlock(NewBB);
-
   // Okay, now we need to adjust the PHI nodes and any branches from within the
   // region to go to the new header block instead of the old header block.
   if (NumPredsFromRegion) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32308.96011.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170420/5d31802b/attachment.bin>


More information about the llvm-commits mailing list