@@ -1264,7 +1264,7 @@ simplifyRelocatesOffABase(GCRelocateInst *RelocatedBase,
12641264 if (auto *RI = dyn_cast<GCRelocateInst>(R))
12651265 if (RI->getStatepoint () == RelocatedBase->getStatepoint ())
12661266 if (RI->getBasePtrIndex () == RelocatedBase->getBasePtrIndex ()) {
1267- RelocatedBase->moveBefore (RI);
1267+ RelocatedBase->moveBefore (RI-> getIterator () );
12681268 MadeChange = true ;
12691269 break ;
12701270 }
@@ -2690,7 +2690,7 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, ModifyDT &ModifiedDT) {
26902690 ExtVal->getParent () == CI->getParent ())
26912691 return false ;
26922692 // Sink a zext feeding stlxr/stxr before it, so it can be folded into it.
2693- ExtVal->moveBefore (CI);
2693+ ExtVal->moveBefore (CI-> getIterator () );
26942694 // Mark this instruction as "inserted by CGP", so that other
26952695 // optimizations don't touch it.
26962696 InsertedInsts.insert (ExtVal);
@@ -3036,7 +3036,7 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
30363036 for (auto *CI : CallInsts) {
30373037 for (auto const *FakeUse : FakeUses) {
30383038 auto *ClonedInst = FakeUse->clone ();
3039- ClonedInst->insertBefore (CI);
3039+ ClonedInst->insertBefore (CI-> getIterator () );
30403040 }
30413041 }
30423042 BB->eraseFromParent ();
@@ -7552,9 +7552,9 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
75527552 // Sink expensive instructions into the conditional blocks to avoid executing
75537553 // them speculatively.
75547554 for (Instruction *I : TrueInstrs)
7555- I->moveBefore (TrueBranch);
7555+ I->moveBefore (TrueBranch-> getIterator () );
75567556 for (Instruction *I : FalseInstrs)
7557- I->moveBefore (FalseBranch);
7557+ I->moveBefore (FalseBranch-> getIterator () );
75587558
75597559 // If we did not create a new block for one of the 'true' or 'false' paths
75607560 // of the condition, it means that side of the branch goes to the end block
@@ -7682,7 +7682,7 @@ bool CodeGenPrepare::tryToSinkFreeOperands(Instruction *I) {
76827682 NewInstructions[UI] = NI;
76837683 MaybeDead.insert (UI);
76847684 LLVM_DEBUG (dbgs () << " Sinking " << *UI << " to user " << *I << " \n " );
7685- NI->insertBefore (InsertPoint);
7685+ NI->insertBefore (InsertPoint-> getIterator () );
76867686 InsertPoint = NI;
76877687 InsertedInsts.insert (NI);
76887688
@@ -7744,7 +7744,7 @@ bool CodeGenPrepare::optimizeSwitchType(SwitchInst *SI) {
77447744 }
77457745
77467746 auto *ExtInst = CastInst::Create (ExtType, Cond, NewType);
7747- ExtInst->insertBefore (SI);
7747+ ExtInst->insertBefore (SI-> getIterator () );
77487748 ExtInst->setDebugLoc (SI->getDebugLoc ());
77497749 SI->setCondition (ExtInst);
77507750 for (auto Case : SI->cases ()) {
@@ -8556,7 +8556,7 @@ static bool optimizeBranch(BranchInst *Branch, const TargetLowering &TLI,
85568556 match (UI, m_Shr (m_Specific (X), m_SpecificInt (CmpC.logBase2 ())))) {
85578557 IRBuilder<> Builder (Branch);
85588558 if (UI->getParent () != Branch->getParent ())
8559- UI->moveBefore (Branch);
8559+ UI->moveBefore (Branch-> getIterator () );
85608560 UI->dropPoisonGeneratingFlags ();
85618561 Value *NewCmp = Builder.CreateCmp (ICmpInst::ICMP_EQ, UI,
85628562 ConstantInt::get (UI->getType (), 0 ));
@@ -8570,7 +8570,7 @@ static bool optimizeBranch(BranchInst *Branch, const TargetLowering &TLI,
85708570 match (UI, m_Sub (m_Specific (X), m_SpecificInt (CmpC))))) {
85718571 IRBuilder<> Builder (Branch);
85728572 if (UI->getParent () != Branch->getParent ())
8573- UI->moveBefore (Branch);
8573+ UI->moveBefore (Branch-> getIterator () );
85748574 UI->dropPoisonGeneratingFlags ();
85758575 Value *NewCmp = Builder.CreateCmp (Cmp->getPredicate (), UI,
85768576 ConstantInt::get (UI->getType (), 0 ));
@@ -8890,21 +8890,21 @@ bool CodeGenPrepare::fixupDbgVariableRecord(DbgVariableRecord &DVR) {
88908890 return AnyChange;
88918891}
88928892
8893- static void DbgInserterHelper (DbgValueInst *DVI, Instruction * VI) {
8893+ static void DbgInserterHelper (DbgValueInst *DVI, BasicBlock::iterator VI) {
88948894 DVI->removeFromParent ();
88958895 if (isa<PHINode>(VI))
8896- DVI->insertBefore (&* VI->getParent ()->getFirstInsertionPt ());
8896+ DVI->insertBefore (VI->getParent ()->getFirstInsertionPt ());
88978897 else
88988898 DVI->insertAfter (VI);
88998899}
89008900
8901- static void DbgInserterHelper (DbgVariableRecord *DVR, Instruction * VI) {
8901+ static void DbgInserterHelper (DbgVariableRecord *DVR, BasicBlock::iterator VI) {
89028902 DVR->removeFromParent ();
89038903 BasicBlock *VIBB = VI->getParent ();
89048904 if (isa<PHINode>(VI))
89058905 VIBB->insertDbgRecordBefore (DVR, VIBB->getFirstInsertionPt ());
89068906 else
8907- VIBB->insertDbgRecordAfter (DVR, VI);
8907+ VIBB->insertDbgRecordAfter (DVR, &* VI);
89088908}
89098909
89108910// A llvm.dbg.value may be using a value before its definition, due to
@@ -8954,7 +8954,7 @@ bool CodeGenPrepare::placeDbgValues(Function &F) {
89548954
89558955 LLVM_DEBUG (dbgs () << " Moving Debug Value before :\n "
89568956 << *DbgItem << ' ' << *VI);
8957- DbgInserterHelper (DbgItem, VI);
8957+ DbgInserterHelper (DbgItem, VI-> getIterator () );
89588958 MadeChange = true ;
89598959 ++NumDbgValueMoved;
89608960 }
@@ -8997,7 +8997,7 @@ bool CodeGenPrepare::placePseudoProbes(Function &F) {
89978997 I++;
89988998 while (I != Block.end ()) {
89998999 if (auto *II = dyn_cast<PseudoProbeInst>(I++)) {
9000- II->moveBefore (&* FirstInst);
9000+ II->moveBefore (FirstInst);
90019001 MadeChange = true ;
90029002 }
90039003 }
@@ -9105,7 +9105,7 @@ bool CodeGenPrepare::splitBranchCondition(Function &F, ModifyDT &ModifiedDT) {
91059105 auto *Br2 = IRBuilder<>(TmpBB).CreateCondBr (Cond2, TBB, FBB);
91069106 if (auto *I = dyn_cast<Instruction>(Cond2)) {
91079107 I->removeFromParent ();
9108- I->insertBefore (Br2);
9108+ I->insertBefore (Br2-> getIterator () );
91099109 }
91109110
91119111 // Update PHI nodes in both successors. The original BB needs to be
0 commit comments