[PATCH] D67521: [BasicBlockUtils] Add optional BBName argument, in line with BB:splitBasicBlock

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 01:04:28 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL371819: [BasicBlockUtils] Add optional BBName argument, in line with BB:splitBasicBlock (authored by fhahn, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D67521?vs=219994&id=220046#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67521

Files:
  llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
  llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
  llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp


Index: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -365,11 +365,13 @@
 
 BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt,
                              DominatorTree *DT, LoopInfo *LI,
-                             MemorySSAUpdater *MSSAU) {
+                             MemorySSAUpdater *MSSAU, const Twine &BBName) {
   BasicBlock::iterator SplitIt = SplitPt->getIterator();
   while (isa<PHINode>(SplitIt) || SplitIt->isEHPad())
     ++SplitIt;
-  BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split");
+  std::string Name = BBName.str();
+  BasicBlock *New = Old->splitBasicBlock(
+      SplitIt, Name.empty() ? Old->getName() + ".split" : Name);
 
   // The new block lives in whichever loop the old one did. This preserves
   // LCSSA as well, because we force the split point to be after any PHI nodes.
Index: llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp
+++ llvm/trunk/lib/Transforms/Utils/LoopVersioning.cpp
@@ -92,8 +92,8 @@
   // Create empty preheader for the loop (and after cloning for the
   // non-versioned loop).
   BasicBlock *PH =
-      SplitBlock(RuntimeCheckBB, RuntimeCheckBB->getTerminator(), DT, LI);
-  PH->setName(VersionedLoop->getHeader()->getName() + ".ph");
+      SplitBlock(RuntimeCheckBB, RuntimeCheckBB->getTerminator(), DT, LI,
+                 nullptr, VersionedLoop->getHeader()->getName() + ".ph");
 
   // Clone the loop including the preheader.
   //
Index: llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
===================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -222,7 +222,8 @@
 /// info is updated.
 BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt,
                        DominatorTree *DT = nullptr, LoopInfo *LI = nullptr,
-                       MemorySSAUpdater *MSSAU = nullptr);
+                       MemorySSAUpdater *MSSAU = nullptr,
+                       const Twine &BBName = "");
 
 /// This method introduces at least one new basic block into the function and
 /// moves some of the predecessors of BB to be predecessors of the new block.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67521.220046.patch
Type: text/x-patch
Size: 2525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190913/a15e4b58/attachment.bin>


More information about the llvm-commits mailing list