[NFC][DebugInfo] Use iterators for insertion at some final callsites

These are the callsites that have materialised in the last three weeks
since I last built with deprecation warnings.
This commit is contained in:
Jeremy Morse 2025-01-28 09:51:14 +00:00
parent 7f845cba2c
commit 304a99091c
6 changed files with 9 additions and 9 deletions

View File

@ -286,7 +286,7 @@ static bool mergeIntoSinglePredecessor_v1(Function &F) {
} }
// Move all instructions from BB to Pred. // Move all instructions from BB to Pred.
for (Instruction &I : make_early_inc_range(BB)) for (Instruction &I : make_early_inc_range(BB))
I.moveBefore(Pred->getTerminator()); I.moveBefore(Pred->getTerminator()->getIterator());
// Remove the Pred's terminator (which jumped to BB). BB's terminator // Remove the Pred's terminator (which jumped to BB). BB's terminator
// will become Pred's terminator. // will become Pred's terminator.
@ -337,7 +337,7 @@ static bool mergeIntoSinglePredecessor_v2(Function &F, DominatorTree &DT) {
} }
// Move all instructions from BB to Pred. // Move all instructions from BB to Pred.
for (Instruction &I : make_early_inc_range(BB)) for (Instruction &I : make_early_inc_range(BB))
I.moveBefore(Pred->getTerminator()); I.moveBefore(Pred->getTerminator()->getIterator());
// Remove the Pred's terminator (which jumped to BB). BB's terminator // Remove the Pred's terminator (which jumped to BB). BB's terminator
// will become Pred's terminator. // will become Pred's terminator.

View File

@ -361,7 +361,7 @@ bool llvm::isDereferenceableAndAlignedInLoop(
} else } else
return false; return false;
Instruction *HeaderFirstNonPHI = L->getHeader()->getFirstNonPHI(); Instruction *HeaderFirstNonPHI = &*L->getHeader()->getFirstNonPHIIt();
return isDereferenceableAndAlignedPointer(Base, Alignment, AccessSize, DL, return isDereferenceableAndAlignedPointer(Base, Alignment, AccessSize, DL,
HeaderFirstNonPHI, AC, &DT); HeaderFirstNonPHI, AC, &DT);
} }

View File

@ -83,7 +83,7 @@ void SPIRVRegularizer::runLowerConstExpr(Function &F) {
LLVM_DEBUG(dbgs() << "[lowerConstantExpressions] " << *CE); LLVM_DEBUG(dbgs() << "[lowerConstantExpressions] " << *CE);
auto ReplInst = CE->getAsInstruction(); auto ReplInst = CE->getAsInstruction();
auto InsPoint = II->getParent() == &*FBegin ? II : &FBegin->back(); auto InsPoint = II->getParent() == &*FBegin ? II : &FBegin->back();
ReplInst->insertBefore(InsPoint); ReplInst->insertBefore(InsPoint->getIterator());
LLVM_DEBUG(dbgs() << " -> " << *ReplInst << '\n'); LLVM_DEBUG(dbgs() << " -> " << *ReplInst << '\n');
std::vector<Instruction *> Users; std::vector<Instruction *> Users;
// Do not replace use during iteration of use. Do it in another loop. // Do not replace use during iteration of use. Do it in another loop.
@ -97,7 +97,7 @@ void SPIRVRegularizer::runLowerConstExpr(Function &F) {
for (auto &User : Users) { for (auto &User : Users) {
if (ReplInst->getParent() == User->getParent() && if (ReplInst->getParent() == User->getParent() &&
User->comesBefore(ReplInst)) User->comesBefore(ReplInst))
ReplInst->moveBefore(User); ReplInst->moveBefore(User->getIterator());
User->replaceUsesOfWith(CE, ReplInst); User->replaceUsesOfWith(CE, ReplInst);
} }
return ReplInst; return ReplInst;

View File

@ -683,7 +683,7 @@ class SPIRVStructurizer : public FunctionPass {
}); });
for (Instruction *I : MergeInstructions) { for (Instruction *I : MergeInstructions) {
I->moveBefore(InsertionPoint); I->moveBefore(InsertionPoint->getIterator());
InsertionPoint = I; InsertionPoint = I;
} }

View File

@ -2044,7 +2044,7 @@ convertFSqrtDivIntoFMul(CallInst *CI, Instruction *X,
// instructions in R2 and get the most common fpmath metadata and fast-math // instructions in R2 and get the most common fpmath metadata and fast-math
// flags on it. // flags on it.
auto *FSqrt = cast<CallInst>(CI->clone()); auto *FSqrt = cast<CallInst>(CI->clone());
FSqrt->insertBefore(CI); FSqrt->insertBefore(CI->getIterator());
auto *R2FPMathMDNode = (*R2.begin())->getMetadata(LLVMContext::MD_fpmath); auto *R2FPMathMDNode = (*R2.begin())->getMetadata(LLVMContext::MD_fpmath);
FastMathFlags R2FMF = (*R2.begin())->getFastMathFlags(); // Common FMF FastMathFlags R2FMF = (*R2.begin())->getFastMathFlags(); // Common FMF
for (Instruction *I : R2) { for (Instruction *I : R2) {

View File

@ -10301,8 +10301,8 @@ preparePlanForEpilogueVectorLoop(VPlan &Plan, Loop *L,
// value. This ensures correctness when the start value might not be // value. This ensures correctness when the start value might not be
// less than the minimum value of a monotonically increasing induction // less than the minimum value of a monotonically increasing induction
// variable. // variable.
IRBuilder<> Builder( BasicBlock *ResumeBB = cast<Instruction>(ResumeV)->getParent();
cast<Instruction>(ResumeV)->getParent()->getFirstNonPHI()); IRBuilder<> Builder(ResumeBB, ResumeBB->getFirstNonPHIIt());
Value *Cmp = Value *Cmp =
Builder.CreateICmpEQ(ResumeV, RdxDesc.getRecurrenceStartValue()); Builder.CreateICmpEQ(ResumeV, RdxDesc.getRecurrenceStartValue());
ResumeV = ResumeV =