Skip to content

Commit c361741

Browse files
committed
[BasicBlockUtils] Expose an internal utility in API [nfc]
Shrinking a patch about to be posted for review.
1 parent f9b438b commit c361741

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,13 @@ void SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
475475
MDNode *BranchWeights = nullptr,
476476
DomTreeUpdater *DTU = nullptr);
477477

478+
/// Insert a for (int i = 0; i < End; i++) loop structure (with the exception
479+
/// that \p End is assumed > 0, and thus not checked on entry) at \p
480+
/// SplitBefore. Returns the first insert point in the loop body, and the
481+
/// PHINode for the induction variable (i.e. "i" above).
482+
std::pair<Instruction*, Value*>
483+
SplitBlockAndInsertSimpleForLoop(Value *End, Instruction *SplitBefore);
484+
478485
/// Utility function for performing a given action on each lane of a vector
479486
/// with \p EC elements. To simplify porting legacy code, this defaults to
480487
/// unrolling the implied loop for non-scalable element counts, but this is

llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,12 +1600,8 @@ void llvm::SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
16001600
}
16011601
}
16021602

1603-
/// Insert a for (int i = 0; i < End; i++) loop structure (with the exception
1604-
/// that \p End is assumed > 0, and thus not checked on entry) at \p
1605-
/// SplitBefore. Returns the first insert point in the loop body, and the
1606-
/// PHINode for the induction variable (i.e. "i" above).
1607-
static std::pair<Instruction*, Value*>
1608-
SplitBlockAndInsertSimpleForLoop(Value *End, Instruction *SplitBefore) {
1603+
std::pair<Instruction*, Value*>
1604+
llvm::SplitBlockAndInsertSimpleForLoop(Value *End, Instruction *SplitBefore) {
16091605
BasicBlock *LoopPred = SplitBefore->getParent();
16101606
BasicBlock *LoopBody = SplitBlock(SplitBefore->getParent(), SplitBefore);
16111607
BasicBlock *LoopExit = SplitBlock(SplitBefore->getParent(), SplitBefore);

0 commit comments

Comments
 (0)