Skip to content

Commit 8e70273

Browse files
authored
[NFC][DebugInfo] Use iterator moveBefore at many call-sites (llvm#123583)
As part of the "RemoveDIs" project, BasicBlock::iterator now carries a debug-info bit that's needed when getFirstNonPHI and similar feed into instruction insertion positions. Call-sites where that's necessary were updated a year ago; but to ensure some type safety however, we'd like to have all calls to moveBefore use iterators. This patch adds a (guaranteed dereferenceable) iterator-taking moveBefore, and changes a bunch of call-sites where it's obviously safe to change to use it by just calling getIterator() on an instruction pointer. A follow-up patch will contain less-obviously-safe changes. We'll eventually deprecate and remove the instruction-pointer insertBefore, but not before adding concise documentation of what considerations are needed (very few).
1 parent e6030d3 commit 8e70273

File tree

89 files changed

+275
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+275
-201
lines changed

clang/lib/CodeGen/CGCoroutine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ struct CallCoroDelete final : public EHScopeStack::Cleanup {
626626

627627
// Get back to the block we were originally and move coro.free there.
628628
auto *InsertPt = SaveInsertBlock->getTerminator();
629-
CoroFree->moveBefore(InsertPt);
629+
CoroFree->moveBefore(InsertPt->getIterator());
630630
CGF.Builder.SetInsertPoint(InsertPt);
631631

632632
// Add if (auto *mem = coro.free) Deallocate;

clang/lib/CodeGen/CGException.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ Address CodeGenFunction::recoverAddrOfEscapedLocal(CodeGenFunction &ParentCGF,
18581858
"expected alloca or localrecover in parent LocalDeclMap");
18591859
RecoverCall = cast<llvm::CallInst>(ParentRecover->clone());
18601860
RecoverCall->setArgOperand(1, ParentFP);
1861-
RecoverCall->insertBefore(AllocaInsertPt);
1861+
RecoverCall->insertBefore(AllocaInsertPt->getIterator());
18621862
}
18631863

18641864
// Bitcast the variable, rename it, and insert it in the local decl map.

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ void CGOpenMPRuntime::setLocThreadIdInsertPt(CodeGenFunction &CGF,
13321332
CGF.Builder.GetInsertBlock());
13331333
} else {
13341334
Elem.ServiceInsertPt = new llvm::BitCastInst(Undef, CGF.Int32Ty, "svcpt");
1335-
Elem.ServiceInsertPt->insertAfter(CGF.AllocaInsertPt);
1335+
Elem.ServiceInsertPt->insertAfter(CGF.AllocaInsertPt->getIterator());
13361336
}
13371337
}
13381338

llvm/include/llvm/IR/BasicBlock.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
194194
// debug-info attachments.
195195
friend void Instruction::insertBefore(BasicBlock::iterator InsertPos);
196196
friend void Instruction::insertAfter(Instruction *InsertPos);
197+
friend void Instruction::insertAfter(BasicBlock::iterator InsertPos);
197198
friend void Instruction::insertBefore(BasicBlock &BB,
198199
InstListType::iterator InsertPos);
199200
friend void Instruction::moveBeforeImpl(BasicBlock &BB,

llvm/include/llvm/IR/DebugProgramInstruction.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,19 @@ class DbgRecord : public ilist_node<DbgRecord> {
192192

193193
DbgRecord *getNextNode() { return &*std::next(getIterator()); }
194194
DbgRecord *getPrevNode() { return &*std::prev(getIterator()); }
195+
196+
// Some generic lambdas supporting intrinsic-based debug-info mean we need
197+
// to support both iterator and instruction position based insertion.
195198
void insertBefore(DbgRecord *InsertBefore);
196199
void insertAfter(DbgRecord *InsertAfter);
197200
void moveBefore(DbgRecord *MoveBefore);
198201
void moveAfter(DbgRecord *MoveAfter);
199202

203+
void insertBefore(self_iterator InsertBefore);
204+
void insertAfter(self_iterator InsertAfter);
205+
void moveBefore(self_iterator MoveBefore);
206+
void moveAfter(self_iterator MoveAfter);
207+
200208
DebugLoc getDebugLoc() const { return DbgLoc; }
201209
void setDebugLoc(DebugLoc Loc) { DbgLoc = std::move(Loc); }
202210

llvm/include/llvm/IR/Instruction.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,19 @@ class Instruction : public User,
207207
/// Insert an unlinked instruction into a basic block immediately before
208208
/// the specified instruction.
209209
void insertBefore(Instruction *InsertPos);
210+
211+
/// Insert an unlinked instruction into a basic block immediately before
212+
/// the specified position.
210213
void insertBefore(InstListType::iterator InsertPos);
211214

212215
/// Insert an unlinked instruction into a basic block immediately after the
213216
/// specified instruction.
214217
void insertAfter(Instruction *InsertPos);
215218

219+
/// Insert an unlinked instruction into a basic block immediately after the
220+
/// specified position.
221+
void insertAfter(InstListType::iterator InsertPos);
222+
216223
/// Inserts an unlinked instruction into \p ParentBB at position \p It and
217224
/// returns the iterator of the inserted instruction.
218225
InstListType::iterator insertInto(BasicBlock *ParentBB,
@@ -224,11 +231,15 @@ class Instruction : public User,
224231
/// the basic block that MovePos lives in, right before MovePos.
225232
void moveBefore(Instruction *MovePos);
226233

234+
/// Unlink this instruction from its current basic block and insert it into
235+
/// the basic block that MovePos lives in, right before MovePos.
236+
void moveBefore(InstListType::iterator InsertPos);
237+
227238
/// Perform a \ref moveBefore operation, while signalling that the caller
228239
/// intends to preserve the original ordering of instructions. This implicitly
229240
/// means that any adjacent debug-info should move with this instruction.
230-
/// This method is currently a no-op placeholder, but it will become meaningful
231-
/// when the "RemoveDIs" project is enabled.
241+
/// This method is currently a no-op placeholder, but it will become
242+
/// meaningful when the "RemoveDIs" project is enabled.
232243
void moveBeforePreserving(Instruction *MovePos);
233244

234245
private:
@@ -242,13 +253,19 @@ class Instruction : public User,
242253
/// \pre I is a valid iterator into BB.
243254
void moveBefore(BasicBlock &BB, InstListType::iterator I);
244255

245-
/// (See other overload for moveBeforePreserving).
246256
void moveBeforePreserving(BasicBlock &BB, InstListType::iterator I);
257+
/// Unlink this instruction from its current basic block and insert it into
258+
/// the basic block that MovePos lives in, right before MovePos.
259+
void moveBeforePreserving(InstListType::iterator I);
247260

248261
/// Unlink this instruction from its current basic block and insert it into
249262
/// the basic block that MovePos lives in, right after MovePos.
250263
void moveAfter(Instruction *MovePos);
251264

265+
/// Unlink this instruction from its current basic block and insert it into
266+
/// the basic block that MovePos lives in, right after MovePos.
267+
void moveAfter(InstListType::iterator MovePos);
268+
252269
/// See \ref moveBeforePreserving .
253270
void moveAfterPreserving(Instruction *MovePos);
254271

llvm/lib/Analysis/LoopInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool Loop::makeLoopInvariant(Instruction *I, bool &Changed,
103103
return false;
104104

105105
// Hoist.
106-
I->moveBefore(InsertPt);
106+
I->moveBefore(InsertPt->getIterator());
107107
if (MSSAU)
108108
if (auto *MUD = MSSAU->getMemorySSA()->getMemoryAccess(I))
109109
MSSAU->moveToPlace(MUD, InsertPt->getParent(),

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

llvm/lib/CodeGen/SelectOptimize.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ static Value *getTrueOrFalseValue(
512512
CBO->setOperand(OtherIdx,
513513
isTrue ? OptSelects[IV].first : OptSelects[IV].second);
514514
}
515-
CBO->insertBefore(B->getTerminator());
515+
CBO->insertBefore(B->getTerminator()->getIterator());
516516
return CBO;
517517
}
518518

@@ -637,7 +637,7 @@ void SelectOptimizeImpl::convertProfitableSIGroups(SelectGroups &ProfSIGroups) {
637637
}
638638
auto InsertionPoint = EndBlock->getFirstInsertionPt();
639639
for (auto *DI : SinkInstrs)
640-
DI->moveBeforePreserving(&*InsertionPoint);
640+
DI->moveBeforePreserving(InsertionPoint);
641641

642642
// Duplicate implementation for DbgRecords, the non-instruction debug-info
643643
// format. Helper lambda for moving DbgRecords to the end block.
@@ -675,7 +675,7 @@ void SelectOptimizeImpl::convertProfitableSIGroups(SelectGroups &ProfSIGroups) {
675675
TrueBranch = BranchInst::Create(EndBlock, TrueBlock);
676676
TrueBranch->setDebugLoc(LastSI.getI()->getDebugLoc());
677677
for (Instruction *TrueInst : TrueSlicesInterleaved)
678-
TrueInst->moveBefore(TrueBranch);
678+
TrueInst->moveBefore(TrueBranch->getIterator());
679679
}
680680
if (!FalseSlicesInterleaved.empty() || HasSelectLike(ASI, false)) {
681681
FalseBlock =
@@ -684,7 +684,7 @@ void SelectOptimizeImpl::convertProfitableSIGroups(SelectGroups &ProfSIGroups) {
684684
FalseBranch = BranchInst::Create(EndBlock, FalseBlock);
685685
FalseBranch->setDebugLoc(LastSI.getI()->getDebugLoc());
686686
for (Instruction *FalseInst : FalseSlicesInterleaved)
687-
FalseInst->moveBefore(FalseBranch);
687+
FalseInst->moveBefore(FalseBranch->getIterator());
688688
}
689689
// If there was nothing to sink, then arbitrarily choose the 'false' side
690690
// for a new input value to the PHI.

llvm/lib/CodeGen/SjLjEHPrepare.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ void SjLjEHPrepareImpl::lowerAcrossUnwindEdges(Function &F,
368368
DemotePHIToStack(PN);
369369

370370
// Move the landingpad instruction back to the top of the landing pad block.
371-
LPI->moveBefore(&UnwindBlock->front());
371+
LPI->moveBefore(UnwindBlock->begin());
372372
}
373373
}
374374

@@ -478,7 +478,7 @@ bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) {
478478
continue;
479479
}
480480
Instruction *StackAddr = CallInst::Create(StackAddrFn, "sp");
481-
StackAddr->insertAfter(&I);
481+
StackAddr->insertAfter(I.getIterator());
482482
new StoreInst(StackAddr, StackPtr, true,
483483
std::next(StackAddr->getIterator()));
484484
}

llvm/lib/CodeGen/StackColoring.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,8 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
937937
// If From is before wo, its possible that there is a use of From between
938938
// them.
939939
if (From->comesBefore(To))
940-
const_cast<AllocaInst*>(To)->moveBefore(const_cast<AllocaInst*>(From));
940+
const_cast<AllocaInst *>(To)->moveBefore(
941+
const_cast<AllocaInst *>(From)->getIterator());
941942

942943
// AA might be used later for instruction scheduling, and we need it to be
943944
// able to deduce the correct aliasing releationships between pointers
@@ -948,7 +949,7 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
948949
Instruction *Inst = const_cast<AllocaInst *>(To);
949950
if (From->getType() != To->getType()) {
950951
BitCastInst *Cast = new BitCastInst(Inst, From->getType());
951-
Cast->insertAfter(Inst);
952+
Cast->insertAfter(Inst->getIterator());
952953
Inst = Cast;
953954
}
954955

llvm/lib/CodeGen/TypePromotion.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ void IRPromoter::ReplaceAllUsersOfWith(Value *From, Value *To) {
436436
void IRPromoter::ExtendSources() {
437437
IRBuilder<> Builder{Ctx};
438438

439-
auto InsertZExt = [&](Value *V, Instruction *InsertPt) {
439+
auto InsertZExt = [&](Value *V, BasicBlock::iterator InsertPt) {
440440
assert(V->getType() != ExtTy && "zext already extends to i32");
441441
LLVM_DEBUG(dbgs() << "IR Promotion: Inserting ZExt for " << *V << "\n");
442442
Builder.SetInsertPoint(InsertPt);
@@ -448,7 +448,7 @@ void IRPromoter::ExtendSources() {
448448
if (isa<Argument>(V))
449449
I->moveBefore(InsertPt);
450450
else
451-
I->moveAfter(InsertPt);
451+
I->moveAfter(&*InsertPt);
452452
NewInsts.insert(I);
453453
}
454454

@@ -460,10 +460,10 @@ void IRPromoter::ExtendSources() {
460460
for (auto *V : Sources) {
461461
LLVM_DEBUG(dbgs() << " - " << *V << "\n");
462462
if (auto *I = dyn_cast<Instruction>(V))
463-
InsertZExt(I, I);
463+
InsertZExt(I, I->getIterator());
464464
else if (auto *Arg = dyn_cast<Argument>(V)) {
465465
BasicBlock &BB = Arg->getParent()->front();
466-
InsertZExt(Arg, &*BB.getFirstInsertionPt());
466+
InsertZExt(Arg, BB.getFirstInsertionPt());
467467
} else {
468468
llvm_unreachable("unhandled source that needs extending");
469469
}
@@ -552,7 +552,7 @@ void IRPromoter::TruncateSinks() {
552552
Value *Arg = Call->getArgOperand(i);
553553
Type *Ty = TruncTysMap[Call][i];
554554
if (Instruction *Trunc = InsertTrunc(Arg, Ty)) {
555-
Trunc->moveBefore(Call);
555+
Trunc->moveBefore(Call->getIterator());
556556
Call->setArgOperand(i, Trunc);
557557
}
558558
}
@@ -563,7 +563,7 @@ void IRPromoter::TruncateSinks() {
563563
if (auto *Switch = dyn_cast<SwitchInst>(I)) {
564564
Type *Ty = TruncTysMap[Switch][0];
565565
if (Instruction *Trunc = InsertTrunc(Switch->getCondition(), Ty)) {
566-
Trunc->moveBefore(Switch);
566+
Trunc->moveBefore(Switch->getIterator());
567567
Switch->setCondition(Trunc);
568568
}
569569
continue;
@@ -583,7 +583,7 @@ void IRPromoter::TruncateSinks() {
583583
for (unsigned i = 0; i < I->getNumOperands(); ++i) {
584584
Type *Ty = TruncTysMap[I][i];
585585
if (Instruction *Trunc = InsertTrunc(I->getOperand(i), Ty)) {
586-
Trunc->moveBefore(I);
586+
Trunc->moveBefore(I->getIterator());
587587
I->setOperand(i, Trunc);
588588
}
589589
}

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,12 +1488,12 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createParallel(
14881488
// Add additional casts to enforce pointers in zero address space
14891489
TIDAddr = new AddrSpaceCastInst(
14901490
TIDAddrAlloca, PointerType ::get(M.getContext(), 0), "tid.addr.ascast");
1491-
TIDAddr->insertAfter(TIDAddrAlloca);
1491+
TIDAddr->insertAfter(TIDAddrAlloca->getIterator());
14921492
ToBeDeleted.push_back(TIDAddr);
14931493
ZeroAddr = new AddrSpaceCastInst(ZeroAddrAlloca,
14941494
PointerType ::get(M.getContext(), 0),
14951495
"zero.addr.ascast");
1496-
ZeroAddr->insertAfter(ZeroAddrAlloca);
1496+
ZeroAddr->insertAfter(ZeroAddrAlloca->getIterator());
14971497
ToBeDeleted.push_back(ZeroAddr);
14981498
}
14991499

0 commit comments

Comments
 (0)