@@ -1264,7 +1264,7 @@ simplifyRelocatesOffABase(GCRelocateInst *RelocatedBase,
1264
1264
if (auto *RI = dyn_cast<GCRelocateInst>(R))
1265
1265
if (RI->getStatepoint () == RelocatedBase->getStatepoint ())
1266
1266
if (RI->getBasePtrIndex () == RelocatedBase->getBasePtrIndex ()) {
1267
- RelocatedBase->moveBefore (RI);
1267
+ RelocatedBase->moveBefore (RI-> getIterator () );
1268
1268
MadeChange = true ;
1269
1269
break ;
1270
1270
}
@@ -2690,7 +2690,7 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, ModifyDT &ModifiedDT) {
2690
2690
ExtVal->getParent () == CI->getParent ())
2691
2691
return false ;
2692
2692
// Sink a zext feeding stlxr/stxr before it, so it can be folded into it.
2693
- ExtVal->moveBefore (CI);
2693
+ ExtVal->moveBefore (CI-> getIterator () );
2694
2694
// Mark this instruction as "inserted by CGP", so that other
2695
2695
// optimizations don't touch it.
2696
2696
InsertedInsts.insert (ExtVal);
@@ -3036,7 +3036,7 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
3036
3036
for (auto *CI : CallInsts) {
3037
3037
for (auto const *FakeUse : FakeUses) {
3038
3038
auto *ClonedInst = FakeUse->clone ();
3039
- ClonedInst->insertBefore (CI);
3039
+ ClonedInst->insertBefore (CI-> getIterator () );
3040
3040
}
3041
3041
}
3042
3042
BB->eraseFromParent ();
@@ -7552,9 +7552,9 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
7552
7552
// Sink expensive instructions into the conditional blocks to avoid executing
7553
7553
// them speculatively.
7554
7554
for (Instruction *I : TrueInstrs)
7555
- I->moveBefore (TrueBranch);
7555
+ I->moveBefore (TrueBranch-> getIterator () );
7556
7556
for (Instruction *I : FalseInstrs)
7557
- I->moveBefore (FalseBranch);
7557
+ I->moveBefore (FalseBranch-> getIterator () );
7558
7558
7559
7559
// If we did not create a new block for one of the 'true' or 'false' paths
7560
7560
// of the condition, it means that side of the branch goes to the end block
@@ -7682,7 +7682,7 @@ bool CodeGenPrepare::tryToSinkFreeOperands(Instruction *I) {
7682
7682
NewInstructions[UI] = NI;
7683
7683
MaybeDead.insert (UI);
7684
7684
LLVM_DEBUG (dbgs () << " Sinking " << *UI << " to user " << *I << " \n " );
7685
- NI->insertBefore (InsertPoint);
7685
+ NI->insertBefore (InsertPoint-> getIterator () );
7686
7686
InsertPoint = NI;
7687
7687
InsertedInsts.insert (NI);
7688
7688
@@ -7744,7 +7744,7 @@ bool CodeGenPrepare::optimizeSwitchType(SwitchInst *SI) {
7744
7744
}
7745
7745
7746
7746
auto *ExtInst = CastInst::Create (ExtType, Cond, NewType);
7747
- ExtInst->insertBefore (SI);
7747
+ ExtInst->insertBefore (SI-> getIterator () );
7748
7748
ExtInst->setDebugLoc (SI->getDebugLoc ());
7749
7749
SI->setCondition (ExtInst);
7750
7750
for (auto Case : SI->cases ()) {
@@ -8556,7 +8556,7 @@ static bool optimizeBranch(BranchInst *Branch, const TargetLowering &TLI,
8556
8556
match (UI, m_Shr (m_Specific (X), m_SpecificInt (CmpC.logBase2 ())))) {
8557
8557
IRBuilder<> Builder (Branch);
8558
8558
if (UI->getParent () != Branch->getParent ())
8559
- UI->moveBefore (Branch);
8559
+ UI->moveBefore (Branch-> getIterator () );
8560
8560
UI->dropPoisonGeneratingFlags ();
8561
8561
Value *NewCmp = Builder.CreateCmp (ICmpInst::ICMP_EQ, UI,
8562
8562
ConstantInt::get (UI->getType (), 0 ));
@@ -8570,7 +8570,7 @@ static bool optimizeBranch(BranchInst *Branch, const TargetLowering &TLI,
8570
8570
match (UI, m_Sub (m_Specific (X), m_SpecificInt (CmpC))))) {
8571
8571
IRBuilder<> Builder (Branch);
8572
8572
if (UI->getParent () != Branch->getParent ())
8573
- UI->moveBefore (Branch);
8573
+ UI->moveBefore (Branch-> getIterator () );
8574
8574
UI->dropPoisonGeneratingFlags ();
8575
8575
Value *NewCmp = Builder.CreateCmp (Cmp->getPredicate (), UI,
8576
8576
ConstantInt::get (UI->getType (), 0 ));
@@ -8890,21 +8890,21 @@ bool CodeGenPrepare::fixupDbgVariableRecord(DbgVariableRecord &DVR) {
8890
8890
return AnyChange;
8891
8891
}
8892
8892
8893
- static void DbgInserterHelper (DbgValueInst *DVI, Instruction * VI) {
8893
+ static void DbgInserterHelper (DbgValueInst *DVI, BasicBlock::iterator VI) {
8894
8894
DVI->removeFromParent ();
8895
8895
if (isa<PHINode>(VI))
8896
- DVI->insertBefore (&* VI->getParent ()->getFirstInsertionPt ());
8896
+ DVI->insertBefore (VI->getParent ()->getFirstInsertionPt ());
8897
8897
else
8898
8898
DVI->insertAfter (VI);
8899
8899
}
8900
8900
8901
- static void DbgInserterHelper (DbgVariableRecord *DVR, Instruction * VI) {
8901
+ static void DbgInserterHelper (DbgVariableRecord *DVR, BasicBlock::iterator VI) {
8902
8902
DVR->removeFromParent ();
8903
8903
BasicBlock *VIBB = VI->getParent ();
8904
8904
if (isa<PHINode>(VI))
8905
8905
VIBB->insertDbgRecordBefore (DVR, VIBB->getFirstInsertionPt ());
8906
8906
else
8907
- VIBB->insertDbgRecordAfter (DVR, VI);
8907
+ VIBB->insertDbgRecordAfter (DVR, &* VI);
8908
8908
}
8909
8909
8910
8910
// A llvm.dbg.value may be using a value before its definition, due to
@@ -8954,7 +8954,7 @@ bool CodeGenPrepare::placeDbgValues(Function &F) {
8954
8954
8955
8955
LLVM_DEBUG (dbgs () << " Moving Debug Value before :\n "
8956
8956
<< *DbgItem << ' ' << *VI);
8957
- DbgInserterHelper (DbgItem, VI);
8957
+ DbgInserterHelper (DbgItem, VI-> getIterator () );
8958
8958
MadeChange = true ;
8959
8959
++NumDbgValueMoved;
8960
8960
}
@@ -8997,7 +8997,7 @@ bool CodeGenPrepare::placePseudoProbes(Function &F) {
8997
8997
I++;
8998
8998
while (I != Block.end ()) {
8999
8999
if (auto *II = dyn_cast<PseudoProbeInst>(I++)) {
9000
- II->moveBefore (&* FirstInst);
9000
+ II->moveBefore (FirstInst);
9001
9001
MadeChange = true ;
9002
9002
}
9003
9003
}
@@ -9105,7 +9105,7 @@ bool CodeGenPrepare::splitBranchCondition(Function &F, ModifyDT &ModifiedDT) {
9105
9105
auto *Br2 = IRBuilder<>(TmpBB).CreateCondBr (Cond2, TBB, FBB);
9106
9106
if (auto *I = dyn_cast<Instruction>(Cond2)) {
9107
9107
I->removeFromParent ();
9108
- I->insertBefore (Br2);
9108
+ I->insertBefore (Br2-> getIterator () );
9109
9109
}
9110
9110
9111
9111
// Update PHI nodes in both successors. The original BB needs to be
0 commit comments