[PATCH] D94176: [SplitEdge] Add new parameter to SplitEdge to name the newly created basic block

Sidharth Baveja via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 07:01:21 PST 2021


sidbav created this revision.
sidbav added reviewers: Whitney, bmahjour, asbirlea.
Herald added a subscriber: hiraditya.
sidbav requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently SplitEdge does not support passing in parameter which allows you to name the newly created BasicBlock.

This patch updates the function such that the name of the block can be passed in, if users of this utility decide to do so.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94176

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


Index: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
===================================================================
--- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -495,7 +495,8 @@
 }
 
 BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, DominatorTree *DT,
-                            LoopInfo *LI, MemorySSAUpdater *MSSAU) {
+                            LoopInfo *LI, MemorySSAUpdater *MSSAU,
+                            const Twine &BBName) {
   unsigned SuccNum = GetSuccessorNumber(BB, Succ);
 
   // If this is a critical edge, let SplitCriticalEdge do it.
@@ -512,14 +513,14 @@
     // block.
     assert(SP == BB && "CFG broken");
     SP = nullptr;
-    return SplitBlock(Succ, &Succ->front(), DT, LI, MSSAU, "", /*Before=*/true);
+    return SplitBlock(Succ, &Succ->front(), DT, LI, MSSAU, BBName, /*Before=*/true);
   }
 
   // Otherwise, if BB has a single successor, split it at the bottom of the
   // block.
   assert(BB->getTerminator()->getNumSuccessors() == 1 &&
          "Should have a single succ!");
-  return SplitBlock(BB, BB->getTerminator(), DT, LI, MSSAU);
+  return SplitBlock(BB, BB->getTerminator(), DT, LI, MSSAU, BBName);
 }
 
 unsigned
Index: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -248,7 +248,8 @@
 /// basic block between \p From and \p To.
 BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To,
                       DominatorTree *DT = nullptr, LoopInfo *LI = nullptr,
-                      MemorySSAUpdater *MSSAU = nullptr);
+                      MemorySSAUpdater *MSSAU = nullptr,
+                      const Twine &BBName = "");
 
 /// Split the specified block at the specified instruction.
 ///


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94176.314886.patch
Type: text/x-patch
Size: 1915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210106/d1d3f0cf/attachment.bin>


More information about the llvm-commits mailing list