Skip to content

Commit 9da1003

Browse files
jmorsechencha3
authored andcommitted
[NFC][RemoveDIs] Use iterators for insertion at various call-sites (llvm#84736)
These are the last remaining "trivial" changes to passes that use Instruction pointers for insertion. All of this should be NFC, it's just changing the spelling of how we identify a position. In one or two locations, I'm also switching uses of getNextNode etc to using std::next with iterators. This too should be NFC. --------- Merged by: Stephen Tozer <[email protected]>
1 parent d7ffc05 commit 9da1003

31 files changed

+152
-123
lines changed

llvm/lib/Analysis/PHITransAddr.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ Value *PHITransAddr::insertTranslatedSubExpr(
369369
// Otherwise insert a cast at the end of PredBB.
370370
CastInst *New = CastInst::Create(Cast->getOpcode(), OpVal, InVal->getType(),
371371
InVal->getName() + ".phi.trans.insert",
372-
PredBB->getTerminator());
372+
PredBB->getTerminator()->getIterator());
373373
New->setDebugLoc(Inst->getDebugLoc());
374374
NewInsts.push_back(New);
375375
return New;
@@ -387,7 +387,8 @@ Value *PHITransAddr::insertTranslatedSubExpr(
387387

388388
GetElementPtrInst *Result = GetElementPtrInst::Create(
389389
GEP->getSourceElementType(), GEPOps[0], ArrayRef(GEPOps).slice(1),
390-
InVal->getName() + ".phi.trans.insert", PredBB->getTerminator());
390+
InVal->getName() + ".phi.trans.insert",
391+
PredBB->getTerminator()->getIterator());
391392
Result->setDebugLoc(Inst->getDebugLoc());
392393
Result->setIsInBounds(GEP->isInBounds());
393394
NewInsts.push_back(Result);
@@ -408,9 +409,9 @@ Value *PHITransAddr::insertTranslatedSubExpr(
408409
if (OpVal == nullptr)
409410
return nullptr;
410411

411-
BinaryOperator *Res = BinaryOperator::CreateAdd(OpVal, Inst->getOperand(1),
412-
InVal->getName()+".phi.trans.insert",
413-
PredBB->getTerminator());
412+
BinaryOperator *Res = BinaryOperator::CreateAdd(
413+
OpVal, Inst->getOperand(1), InVal->getName() + ".phi.trans.insert",
414+
PredBB->getTerminator()->getIterator());
414415
Res->setHasNoSignedWrap(cast<BinaryOperator>(Inst)->hasNoSignedWrap());
415416
Res->setHasNoUnsignedWrap(cast<BinaryOperator>(Inst)->hasNoUnsignedWrap());
416417
NewInsts.push_back(Res);

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,9 +2057,9 @@ static bool sinkAndCmp0Expression(Instruction *AndI, const TargetLowering &TLI,
20572057
// Keep the 'and' in the same place if the use is already in the same block.
20582058
Instruction *InsertPt =
20592059
User->getParent() == AndI->getParent() ? AndI : User;
2060-
Instruction *InsertedAnd =
2061-
BinaryOperator::Create(Instruction::And, AndI->getOperand(0),
2062-
AndI->getOperand(1), "", InsertPt);
2060+
Instruction *InsertedAnd = BinaryOperator::Create(
2061+
Instruction::And, AndI->getOperand(0), AndI->getOperand(1), "",
2062+
InsertPt->getIterator());
20632063
// Propagate the debug info.
20642064
InsertedAnd->setDebugLoc(AndI->getDebugLoc());
20652065

@@ -4153,9 +4153,10 @@ class AddressingModeCombiner {
41534153
if (SelectInst *CurrentSelect = dyn_cast<SelectInst>(Current)) {
41544154
// Is it OK to get metadata from OrigSelect?!
41554155
// Create a Select placeholder with dummy value.
4156-
SelectInst *Select = SelectInst::Create(
4157-
CurrentSelect->getCondition(), Dummy, Dummy,
4158-
CurrentSelect->getName(), CurrentSelect, CurrentSelect);
4156+
SelectInst *Select =
4157+
SelectInst::Create(CurrentSelect->getCondition(), Dummy, Dummy,
4158+
CurrentSelect->getName(),
4159+
CurrentSelect->getIterator(), CurrentSelect);
41594160
Map[Current] = Select;
41604161
ST.insertNewSelect(Select);
41614162
// We are interested in True and False values.
@@ -6466,8 +6467,8 @@ bool CodeGenPrepare::optimizePhiType(
64666467
ValMap[D] = D->getOperand(0);
64676468
DeletedInstrs.insert(D);
64686469
} else {
6469-
ValMap[D] =
6470-
new BitCastInst(D, ConvertTy, D->getName() + ".bc", D->getNextNode());
6470+
BasicBlock::iterator insertPt = std::next(D->getIterator());
6471+
ValMap[D] = new BitCastInst(D, ConvertTy, D->getName() + ".bc", insertPt);
64716472
}
64726473
}
64736474
for (PHINode *Phi : PhiNodes)
@@ -6487,8 +6488,8 @@ bool CodeGenPrepare::optimizePhiType(
64876488
DeletedInstrs.insert(U);
64886489
replaceAllUsesWith(U, ValMap[U->getOperand(0)], FreshBBs, IsHugeFunc);
64896490
} else {
6490-
U->setOperand(0,
6491-
new BitCastInst(ValMap[U->getOperand(0)], PhiTy, "bc", U));
6491+
U->setOperand(0, new BitCastInst(ValMap[U->getOperand(0)], PhiTy, "bc",
6492+
U->getIterator()));
64926493
}
64936494
}
64946495

@@ -8384,7 +8385,7 @@ bool CodeGenPrepare::optimizeInst(Instruction *I, ModifyDT &ModifiedDT) {
83848385
if (GEPI->hasAllZeroIndices()) {
83858386
/// The GEP operand must be a pointer, so must its result -> BitCast
83868387
Instruction *NC = new BitCastInst(GEPI->getOperand(0), GEPI->getType(),
8387-
GEPI->getName(), GEPI);
8388+
GEPI->getName(), GEPI->getIterator());
83888389
NC->setDebugLoc(GEPI->getDebugLoc());
83898390
replaceAllUsesWith(GEPI, NC, FreshBBs, IsHugeFunc);
83908391
RecursivelyDeleteTriviallyDeadInstructions(
@@ -8416,7 +8417,7 @@ bool CodeGenPrepare::optimizeInst(Instruction *I, ModifyDT &ModifiedDT) {
84168417
isa<ConstantPointerNull>(Op1);
84178418
if (Const0 || Const1) {
84188419
if (!Const0 || !Const1) {
8419-
auto *F = new FreezeInst(Const0 ? Op1 : Op0, "", CmpI);
8420+
auto *F = new FreezeInst(Const0 ? Op1 : Op0, "", CmpI->getIterator());
84208421
F->takeName(FI);
84218422
CmpI->setOperand(Const0 ? 1 : 0, F);
84228423
}

llvm/lib/CodeGen/DwarfEHPrepare.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ Value *DwarfEHPrepare::GetExceptionObject(ResumeInst *RI) {
111111
}
112112

113113
if (!ExnObj)
114-
ExnObj = ExtractValueInst::Create(RI->getOperand(0), 0, "exn.obj", RI);
114+
ExnObj = ExtractValueInst::Create(RI->getOperand(0), 0, "exn.obj",
115+
RI->getIterator());
115116

116117
RI->eraseFromParent();
117118

@@ -158,7 +159,7 @@ size_t DwarfEHPrepare::pruneUnreachableResumes(
158159
Resumes[ResumesLeft++] = RI;
159160
} else {
160161
BasicBlock *BB = RI->getParent();
161-
new UnreachableInst(Ctx, RI);
162+
new UnreachableInst(Ctx, RI->getIterator());
162163
RI->eraseFromParent();
163164
simplifyCFG(BB, *TTI, DTU);
164165
}

llvm/lib/CodeGen/GCRootLowering.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static bool InsertRootInitializers(Function &F, ArrayRef<AllocaInst *> Roots) {
181181
if (!InitedRoots.count(Root)) {
182182
new StoreInst(
183183
ConstantPointerNull::get(cast<PointerType>(Root->getAllocatedType())),
184-
Root, Root->getNextNode());
184+
Root, std::next(Root->getIterator()));
185185
MadeChange = true;
186186
}
187187

@@ -216,16 +216,17 @@ bool DoLowering(Function &F, GCStrategy &S) {
216216
default: break;
217217
case Intrinsic::gcwrite: {
218218
// Replace a write barrier with a simple store.
219-
Value *St = new StoreInst(CI->getArgOperand(0),
220-
CI->getArgOperand(2), CI);
219+
Value *St = new StoreInst(CI->getArgOperand(0), CI->getArgOperand(2),
220+
CI->getIterator());
221221
CI->replaceAllUsesWith(St);
222222
CI->eraseFromParent();
223223
MadeChange = true;
224224
break;
225225
}
226226
case Intrinsic::gcread: {
227227
// Replace a read barrier with a simple load.
228-
Value *Ld = new LoadInst(CI->getType(), CI->getArgOperand(1), "", CI);
228+
Value *Ld = new LoadInst(CI->getType(), CI->getArgOperand(1), "",
229+
CI->getIterator());
229230
Ld->takeName(CI);
230231
CI->replaceAllUsesWith(Ld);
231232
CI->eraseFromParent();

llvm/lib/CodeGen/IndirectBrExpandPass.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ bool runImpl(Function &F, const TargetLowering *TLI, DomTreeUpdater *DTU) {
113113
// Handle the degenerate case of no successors by replacing the indirectbr
114114
// with unreachable as there is no successor available.
115115
if (IBr->getNumSuccessors() == 0) {
116-
(void)new UnreachableInst(F.getContext(), IBr);
116+
(void)new UnreachableInst(F.getContext(), IBr->getIterator());
117117
IBr->eraseFromParent();
118118
continue;
119119
}
@@ -183,7 +183,7 @@ bool runImpl(Function &F, const TargetLowering *TLI, DomTreeUpdater *DTU) {
183183
for (BasicBlock *SuccBB : IBr->successors())
184184
Updates.push_back({DominatorTree::Delete, IBr->getParent(), SuccBB});
185185
}
186-
(void)new UnreachableInst(F.getContext(), IBr);
186+
(void)new UnreachableInst(F.getContext(), IBr->getIterator());
187187
IBr->eraseFromParent();
188188
}
189189
if (DTU) {
@@ -207,9 +207,10 @@ bool runImpl(Function &F, const TargetLowering *TLI, DomTreeUpdater *DTU) {
207207
}
208208

209209
auto GetSwitchValue = [CommonITy](IndirectBrInst *IBr) {
210-
return CastInst::CreatePointerCast(
211-
IBr->getAddress(), CommonITy,
212-
Twine(IBr->getAddress()->getName()) + ".switch_cast", IBr);
210+
return CastInst::CreatePointerCast(IBr->getAddress(), CommonITy,
211+
Twine(IBr->getAddress()->getName()) +
212+
".switch_cast",
213+
IBr->getIterator());
213214
};
214215

215216
SmallVector<DominatorTree::UpdateType, 8> Updates;
@@ -243,7 +244,7 @@ bool runImpl(Function &F, const TargetLowering *TLI, DomTreeUpdater *DTU) {
243244
Updates.reserve(IndirectBrs.size() + 2 * IndirectBrSuccs.size());
244245
for (auto *IBr : IndirectBrs) {
245246
SwitchPN->addIncoming(GetSwitchValue(IBr), IBr->getParent());
246-
BranchInst::Create(SwitchBB, IBr);
247+
BranchInst::Create(SwitchBB, IBr->getIterator());
247248
if (DTU) {
248249
Updates.push_back({DominatorTree::Insert, IBr->getParent(), SwitchBB});
249250
for (BasicBlock *SuccBB : IBr->successors())

llvm/lib/CodeGen/InterleavedAccessPass.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,15 @@ bool InterleavedAccessImpl::replaceBinOpShuffles(
388388
return Idx < (int)cast<FixedVectorType>(BIOp0Ty)->getNumElements();
389389
}));
390390

391+
BasicBlock::iterator insertPos = SVI->getIterator();
391392
auto *NewSVI1 =
392393
new ShuffleVectorInst(BI->getOperand(0), PoisonValue::get(BIOp0Ty),
393-
Mask, SVI->getName(), SVI);
394+
Mask, SVI->getName(), insertPos);
394395
auto *NewSVI2 = new ShuffleVectorInst(
395396
BI->getOperand(1), PoisonValue::get(BI->getOperand(1)->getType()), Mask,
396-
SVI->getName(), SVI);
397+
SVI->getName(), insertPos);
397398
BinaryOperator *NewBI = BinaryOperator::CreateWithCopiedFlags(
398-
BI->getOpcode(), NewSVI1, NewSVI2, BI, BI->getName(), SVI);
399+
BI->getOpcode(), NewSVI1, NewSVI2, BI, BI->getName(), insertPos);
399400
SVI->replaceAllUsesWith(NewBI);
400401
LLVM_DEBUG(dbgs() << " Replaced: " << *BI << "\n And : " << *SVI
401402
<< "\n With : " << *NewSVI1 << "\n And : "

llvm/lib/CodeGen/IntrinsicLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ bool IntrinsicLowering::LowerToByteSwap(CallInst *CI) {
472472
Function *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Ty);
473473

474474
Value *Op = CI->getArgOperand(0);
475-
Op = CallInst::Create(Int, Op, CI->getName(), CI);
475+
Op = CallInst::Create(Int, Op, CI->getName(), CI->getIterator());
476476

477477
CI->replaceAllUsesWith(Op);
478478
CI->eraseFromParent();

llvm/lib/CodeGen/JMCInstrumenter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ bool runImpl(Module &M) {
227227
// FIXME: it would be nice to make CI scheduling boundary, although in
228228
// practice it does not matter much.
229229
auto *CI = CallInst::Create(getCheckFunctionType(Ctx), CheckFunction,
230-
{Flag}, "", &*F.begin()->getFirstInsertionPt());
230+
{Flag}, "", F.begin()->getFirstInsertionPt());
231231
CI->addParamAttr(0, Attribute::NoUndef);
232232
if (UseX86FastCall) {
233233
CI->setCallingConv(CallingConv::X86_FastCall);

llvm/lib/CodeGen/SjLjEHPrepare.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ SjLjEHPrepareImpl::setupFunctionContext(Function &F,
202202
auto &DL = F.getParent()->getDataLayout();
203203
const Align Alignment = DL.getPrefTypeAlign(FunctionContextTy);
204204
FuncCtx = new AllocaInst(FunctionContextTy, DL.getAllocaAddrSpace(), nullptr,
205-
Alignment, "fn_context", &EntryBB->front());
205+
Alignment, "fn_context", EntryBB->begin());
206206

207207
// Fill in the function context structure.
208208
for (LandingPadInst *LPI : LPads) {
@@ -271,7 +271,7 @@ void SjLjEHPrepareImpl::lowerIncomingArguments(Function &F) {
271271
Value *TrueValue = ConstantInt::getTrue(F.getContext());
272272
Value *UndefValue = UndefValue::get(Ty);
273273
Instruction *SI = SelectInst::Create(
274-
TrueValue, &AI, UndefValue, AI.getName() + ".tmp", &*AfterAllocaInsPt);
274+
TrueValue, &AI, UndefValue, AI.getName() + ".tmp", AfterAllocaInsPt);
275275
AI.replaceAllUsesWith(SI);
276276

277277
// Reset the operand, because it was clobbered by the RAUW above.
@@ -386,7 +386,7 @@ bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) {
386386
if (Function *Callee = II->getCalledFunction())
387387
if (Callee->getIntrinsicID() == Intrinsic::donothing) {
388388
// Remove the NOP invoke.
389-
BranchInst::Create(II->getNormalDest(), II);
389+
BranchInst::Create(II->getNormalDest(), II->getIterator());
390390
II->eraseFromParent();
391391
continue;
392392
}
@@ -445,7 +445,7 @@ bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) {
445445

446446
// Record the call site value for the back end so it stays associated with
447447
// the invoke.
448-
CallInst::Create(CallSiteFn, CallSiteNum, "", Invokes[I]);
448+
CallInst::Create(CallSiteFn, CallSiteNum, "", Invokes[I]->getIterator());
449449
}
450450

451451
// Mark call instructions that aren't nounwind as no-action (call_site ==
@@ -462,8 +462,8 @@ bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) {
462462
}
463463

464464
// Register the function context and make sure it's known to not throw
465-
CallInst *Register =
466-
CallInst::Create(RegisterFn, FuncCtx, "", EntryBB->getTerminator());
465+
CallInst *Register = CallInst::Create(
466+
RegisterFn, FuncCtx, "", EntryBB->getTerminator()->getIterator());
467467
Register->setDoesNotThrow();
468468

469469
// Following any allocas not in the entry block, update the saved SP in the
@@ -480,7 +480,8 @@ bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) {
480480
}
481481
Instruction *StackAddr = CallInst::Create(StackAddrFn, "sp");
482482
StackAddr->insertAfter(&I);
483-
new StoreInst(StackAddr, StackPtr, true, StackAddr->getNextNode());
483+
new StoreInst(StackAddr, StackPtr, true,
484+
std::next(StackAddr->getIterator()));
484485
}
485486
}
486487

@@ -490,7 +491,7 @@ bool SjLjEHPrepareImpl::setupEntryBlockAndCallSites(Function &F) {
490491
Instruction *InsertPoint = Return;
491492
if (CallInst *CI = Return->getParent()->getTerminatingMustTailCall())
492493
InsertPoint = CI;
493-
CallInst::Create(UnregisterFn, FuncCtx, "", InsertPoint);
494+
CallInst::Create(UnregisterFn, FuncCtx, "", InsertPoint->getIterator());
494495
}
495496

496497
return true;

llvm/lib/CodeGen/WinEHPrepare.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,10 +1234,10 @@ AllocaInst *WinEHPrepareImpl::insertPHILoads(PHINode *PN, Function &F) {
12341234
// that will dominate all uses.
12351235
SpillSlot = new AllocaInst(PN->getType(), DL->getAllocaAddrSpace(), nullptr,
12361236
Twine(PN->getName(), ".wineh.spillslot"),
1237-
&F.getEntryBlock().front());
1237+
F.getEntryBlock().begin());
12381238
Value *V = new LoadInst(PN->getType(), SpillSlot,
12391239
Twine(PN->getName(), ".wineh.reload"),
1240-
&*PHIBlock->getFirstInsertionPt());
1240+
PHIBlock->getFirstInsertionPt());
12411241
PN->replaceAllUsesWith(V);
12421242
return SpillSlot;
12431243
}
@@ -1309,7 +1309,7 @@ void WinEHPrepareImpl::insertPHIStore(
13091309
}
13101310

13111311
// Otherwise, insert the store at the end of the basic block.
1312-
new StoreInst(PredVal, SpillSlot, PredBlock->getTerminator());
1312+
new StoreInst(PredVal, SpillSlot, PredBlock->getTerminator()->getIterator());
13131313
}
13141314

13151315
void WinEHPrepareImpl::replaceUseWithLoad(
@@ -1319,7 +1319,7 @@ void WinEHPrepareImpl::replaceUseWithLoad(
13191319
if (!SpillSlot)
13201320
SpillSlot = new AllocaInst(V->getType(), DL->getAllocaAddrSpace(), nullptr,
13211321
Twine(V->getName(), ".wineh.spillslot"),
1322-
&F.getEntryBlock().front());
1322+
F.getEntryBlock().begin());
13231323

13241324
auto *UsingInst = cast<Instruction>(U.getUser());
13251325
if (auto *UsingPHI = dyn_cast<PHINode>(UsingInst)) {
@@ -1376,16 +1376,16 @@ void WinEHPrepareImpl::replaceUseWithLoad(
13761376
Value *&Load = Loads[IncomingBlock];
13771377
// Insert the load into the predecessor block
13781378
if (!Load)
1379-
Load = new LoadInst(V->getType(), SpillSlot,
1380-
Twine(V->getName(), ".wineh.reload"),
1381-
/*isVolatile=*/false, IncomingBlock->getTerminator());
1379+
Load = new LoadInst(
1380+
V->getType(), SpillSlot, Twine(V->getName(), ".wineh.reload"),
1381+
/*isVolatile=*/false, IncomingBlock->getTerminator()->getIterator());
13821382

13831383
U.set(Load);
13841384
} else {
13851385
// Reload right before the old use.
13861386
auto *Load = new LoadInst(V->getType(), SpillSlot,
13871387
Twine(V->getName(), ".wineh.reload"),
1388-
/*isVolatile=*/false, UsingInst);
1388+
/*isVolatile=*/false, UsingInst->getIterator());
13891389
U.set(Load);
13901390
}
13911391
}

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ class TriggerVerifierErrorPass
358358
// Intentionally break the Function by inserting a terminator
359359
// instruction in the middle of a basic block.
360360
BasicBlock &BB = F.getEntryBlock();
361-
new UnreachableInst(F.getContext(), BB.getTerminator());
361+
new UnreachableInst(F.getContext(), BB.getTerminator()->getIterator());
362362
return PreservedAnalyses::none();
363363
}
364364

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ static std::optional<Instruction *> instCombineSVELast(InstCombiner &IC,
11291129
auto *NewRHS =
11301130
IC.Builder.CreateIntrinsic(IntrinsicID, {Vec->getType()}, {Pg, RHS});
11311131
auto *NewBinOp = BinaryOperator::CreateWithCopiedFlags(
1132-
OpC, NewLHS, NewRHS, OldBinOp, OldBinOp->getName(), &II);
1132+
OpC, NewLHS, NewRHS, OldBinOp, OldBinOp->getName(), II.getIterator());
11331133
return IC.replaceInstUsesWith(II, NewBinOp);
11341134
}
11351135
}

llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,11 @@ bool AMDGPULibCalls::sincosUseNative(CallInst *aCI, const FuncInfo &FInfo) {
470470
nf.setId(AMDGPULibFunc::EI_COS);
471471
FunctionCallee cosExpr = getFunction(M, nf);
472472
if (sinExpr && cosExpr) {
473-
Value *sinval = CallInst::Create(sinExpr, opr0, "splitsin", aCI);
474-
Value *cosval = CallInst::Create(cosExpr, opr0, "splitcos", aCI);
475-
new StoreInst(cosval, aCI->getArgOperand(1), aCI);
473+
Value *sinval =
474+
CallInst::Create(sinExpr, opr0, "splitsin", aCI->getIterator());
475+
Value *cosval =
476+
CallInst::Create(cosExpr, opr0, "splitcos", aCI->getIterator());
477+
new StoreInst(cosval, aCI->getArgOperand(1), aCI->getIterator());
476478

477479
DEBUG_WITH_TYPE("usenative", dbgs() << "<useNative> replace " << *aCI
478480
<< " with native version of sin/cos");
@@ -1655,7 +1657,7 @@ bool AMDGPULibCalls::evaluateCall(CallInst *aCI, const FuncInfo &FInfo) {
16551657
// sincos
16561658
assert(FInfo.getId() == AMDGPULibFunc::EI_SINCOS &&
16571659
"math function with ptr arg not supported yet");
1658-
new StoreInst(nval1, aCI->getArgOperand(1), aCI);
1660+
new StoreInst(nval1, aCI->getArgOperand(1), aCI->getIterator());
16591661
}
16601662

16611663
replaceCall(aCI, nval0);

0 commit comments

Comments
 (0)