[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 14:53:23 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL300899: Use basicblock split block utility function (authored by davidxl).

Changed prior to commit:
  https://reviews.llvm.org/D32308?vs=96011&id=96029#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32308

Files:
  llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp


Index: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
+++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
@@ -194,22 +194,15 @@
   // 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 *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) {
@@ -224,6 +217,7 @@
 
     // Okay, everything within the region is now branching to the right block, we
     // just have to update the PHI nodes now, inserting PHI nodes into NewBB.
+    BasicBlock::iterator AfterPHIs;
     for (AfterPHIs = OldPred->begin(); isa<PHINode>(AfterPHIs); ++AfterPHIs) {
       PHINode *PN = cast<PHINode>(AfterPHIs);
       // Create a new PHI node in the new region, which has an incoming value


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


More information about the llvm-commits mailing list