[llvm] c361741 - [BasicBlockUtils] Expose an internal utility in API [nfc]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 14:11:26 PDT 2023


Author: Philip Reames
Date: 2023-03-14T14:11:16-07:00
New Revision: c361741a271db0330f17dbebec18dcb4779a6252

URL: https://github.com/llvm/llvm-project/commit/c361741a271db0330f17dbebec18dcb4779a6252
DIFF: https://github.com/llvm/llvm-project/commit/c361741a271db0330f17dbebec18dcb4779a6252.diff

LOG: [BasicBlockUtils] Expose an internal utility in API [nfc]

Shrinking a patch about to be posted for review.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
index b657e2b46f6a8..bc1bba1ff59ac 100644
--- a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -475,6 +475,13 @@ void SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
                                    MDNode *BranchWeights = nullptr,
                                    DomTreeUpdater *DTU = nullptr);
 
+/// Insert a for (int i = 0; i < End; i++) loop structure (with the exception
+/// that \p End is assumed > 0, and thus not checked on entry) at \p
+/// SplitBefore.  Returns the first insert point in the loop body, and the
+/// PHINode for the induction variable (i.e. "i" above).
+std::pair<Instruction*, Value*>
+SplitBlockAndInsertSimpleForLoop(Value *End, Instruction *SplitBefore);
+
 /// Utility function for performing a given action on each lane of a vector
 /// with \p EC elements.  To simplify porting legacy code, this defaults to
 /// unrolling the implied loop for non-scalable element counts, but this is

diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 2d1be2c487394..f0e24650cd5e2 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -1600,12 +1600,8 @@ void llvm::SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
   }
 }
 
-/// Insert a for (int i = 0; i < End; i++) loop structure (with the exception
-/// that \p End is assumed > 0, and thus not checked on entry) at \p
-/// SplitBefore.  Returns the first insert point in the loop body, and the
-/// PHINode for the induction variable (i.e. "i" above).
-static std::pair<Instruction*, Value*>
-SplitBlockAndInsertSimpleForLoop(Value *End, Instruction *SplitBefore) {
+std::pair<Instruction*, Value*>
+llvm::SplitBlockAndInsertSimpleForLoop(Value *End, Instruction *SplitBefore) {
   BasicBlock *LoopPred = SplitBefore->getParent();
   BasicBlock *LoopBody = SplitBlock(SplitBefore->getParent(), SplitBefore);
   BasicBlock *LoopExit = SplitBlock(SplitBefore->getParent(), SplitBefore);


        


More information about the llvm-commits mailing list