Skip to content

Commit d529943

Browse files
committed
[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine
As per my proposal for how to eliminate debug intrinsics [0], for various places in InstCombine prefer to insert using an instruction iterator rather than an instruction pointer. This is so that we can eventually pass more information in the iterator class. These call-sites where I've changed the spelling are those that necessary to build a stage2clang to produce an identical binary in the coming no-debug-intrinsics mode. [0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939 Differential Revision: https://reviews.llvm.org/D152543
1 parent edc2fb0 commit d529943

11 files changed

+57
-58
lines changed

llvm/include/llvm/Transforms/InstCombine/InstCombiner.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,18 +398,17 @@ class LLVM_LIBRARY_VISIBILITY InstCombiner {
398398
///
399399
/// Also adds the new instruction to the worklist and returns \p New so that
400400
/// it is suitable for use as the return from the visitation patterns.
401-
Instruction *InsertNewInstBefore(Instruction *New, Instruction &Old) {
401+
Instruction *InsertNewInstBefore(Instruction *New, BasicBlock::iterator Old) {
402402
assert(New && !New->getParent() &&
403403
"New instruction already inserted into a basic block!");
404-
BasicBlock *BB = Old.getParent();
405-
New->insertInto(BB, Old.getIterator()); // Insert inst
404+
New->insertBefore(Old); // Insert inst
406405
Worklist.add(New);
407406
return New;
408407
}
409408

410409
/// Same as InsertNewInstBefore, but also sets the debug loc.
411-
Instruction *InsertNewInstWith(Instruction *New, Instruction &Old) {
412-
New->setDebugLoc(Old.getDebugLoc());
410+
Instruction *InsertNewInstWith(Instruction *New, BasicBlock::iterator Old) {
411+
New->setDebugLoc(Old->getDebugLoc());
413412
return InsertNewInstBefore(New, Old);
414413
}
415414

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3994,7 +3994,7 @@ bool InstCombinerImpl::transformConstExprCastCall(CallBase &Call) {
39943994

39953995
Instruction *InsertPt = NewCall->getInsertionPointAfterDef();
39963996
assert(InsertPt && "No place to insert cast");
3997-
InsertNewInstBefore(NC, *InsertPt);
3997+
InsertNewInstBefore(NC, InsertPt->getIterator());
39983998
Worklist.pushUsersToWorkList(*Caller);
39993999
} else {
40004000
NV = PoisonValue::get(Caller->getType());

llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Value *InstCombinerImpl::EvaluateInDifferentType(Value *V, Type *Ty,
112112
}
113113

114114
Res->takeName(I);
115-
return InsertNewInstWith(Res, *I);
115+
return InsertNewInstWith(Res, I->getIterator());
116116
}
117117

118118
Instruction::CastOps

llvm/lib/Transforms/InstCombine/InstCombineInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
423423
auto *SI = new StoreInst(ConstantInt::getTrue(Ctx),
424424
PoisonValue::get(PointerType::getUnqual(Ctx)),
425425
/*isVolatile*/ false, Align(1));
426-
InsertNewInstBefore(SI, *InsertAt);
426+
InsertNewInstBefore(SI, InsertAt->getIterator());
427427
}
428428

429429
/// Combiner aware instruction erasure.

llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static Instruction *simplifyAllocaArraySize(InstCombinerImpl &IC,
224224
Value *Idx[2] = {NullIdx, NullIdx};
225225
Instruction *GEP = GetElementPtrInst::CreateInBounds(
226226
NewTy, New, Idx, New->getName() + ".sub");
227-
IC.InsertNewInstBefore(GEP, *It);
227+
IC.InsertNewInstBefore(GEP, It);
228228

229229
// Now make everything use the getelementptr instead of the original
230230
// allocation.
@@ -380,7 +380,7 @@ void PointerReplacer::replace(Instruction *I) {
380380
NewI->takeName(LT);
381381
copyMetadataForLoad(*NewI, *LT);
382382

383-
IC.InsertNewInstWith(NewI, *LT);
383+
IC.InsertNewInstWith(NewI, LT->getIterator());
384384
IC.replaceInstUsesWith(*LT, NewI);
385385
WorkMap[LT] = NewI;
386386
} else if (auto *PHI = dyn_cast<PHINode>(I)) {
@@ -398,7 +398,7 @@ void PointerReplacer::replace(Instruction *I) {
398398
Indices.append(GEP->idx_begin(), GEP->idx_end());
399399
auto *NewI =
400400
GetElementPtrInst::Create(GEP->getSourceElementType(), V, Indices);
401-
IC.InsertNewInstWith(NewI, *GEP);
401+
IC.InsertNewInstWith(NewI, GEP->getIterator());
402402
NewI->takeName(GEP);
403403
WorkMap[GEP] = NewI;
404404
} else if (auto *BC = dyn_cast<BitCastInst>(I)) {
@@ -407,14 +407,14 @@ void PointerReplacer::replace(Instruction *I) {
407407
auto *NewT = PointerType::get(BC->getType()->getContext(),
408408
V->getType()->getPointerAddressSpace());
409409
auto *NewI = new BitCastInst(V, NewT);
410-
IC.InsertNewInstWith(NewI, *BC);
410+
IC.InsertNewInstWith(NewI, BC->getIterator());
411411
NewI->takeName(BC);
412412
WorkMap[BC] = NewI;
413413
} else if (auto *SI = dyn_cast<SelectInst>(I)) {
414414
auto *NewSI = SelectInst::Create(
415415
SI->getCondition(), getReplacement(SI->getTrueValue()),
416416
getReplacement(SI->getFalseValue()), SI->getName(), nullptr, SI);
417-
IC.InsertNewInstWith(NewSI, *SI);
417+
IC.InsertNewInstWith(NewSI, SI->getIterator());
418418
NewSI->takeName(SI);
419419
WorkMap[SI] = NewSI;
420420
} else if (auto *MemCpy = dyn_cast<MemTransferInst>(I)) {
@@ -449,7 +449,7 @@ void PointerReplacer::replace(Instruction *I) {
449449
ASC->getType()->getPointerAddressSpace()) {
450450
auto *NewI = new AddrSpaceCastInst(V, ASC->getType(), "");
451451
NewI->takeName(ASC);
452-
IC.InsertNewInstWith(NewI, *ASC);
452+
IC.InsertNewInstWith(NewI, ASC->getIterator());
453453
NewV = NewI;
454454
}
455455
IC.replaceInstUsesWith(*ASC, NewV);
@@ -1006,7 +1006,7 @@ static Instruction *replaceGEPIdxWithZero(InstCombinerImpl &IC, Value *Ptr,
10061006
Instruction *NewGEPI = GEPI->clone();
10071007
NewGEPI->setOperand(Idx,
10081008
ConstantInt::get(GEPI->getOperand(Idx)->getType(), 0));
1009-
IC.InsertNewInstBefore(NewGEPI, *GEPI);
1009+
IC.InsertNewInstBefore(NewGEPI, GEPI->getIterator());
10101010
return NewGEPI;
10111011
}
10121012
}
@@ -1669,7 +1669,7 @@ bool InstCombinerImpl::mergeStoreIntoSuccessor(StoreInst &SI) {
16691669
Builder.SetInsertPoint(OtherStore);
16701670
PN->addIncoming(Builder.CreateBitOrPointerCast(MergedVal, PN->getType()),
16711671
OtherBB);
1672-
MergedVal = InsertNewInstBefore(PN, DestBB->front());
1672+
MergedVal = InsertNewInstBefore(PN, DestBB->begin());
16731673
PN->setDebugLoc(MergedLoc);
16741674
}
16751675

@@ -1678,7 +1678,7 @@ bool InstCombinerImpl::mergeStoreIntoSuccessor(StoreInst &SI) {
16781678
StoreInst *NewSI =
16791679
new StoreInst(MergedVal, SI.getOperand(1), SI.isVolatile(), SI.getAlign(),
16801680
SI.getOrdering(), SI.getSyncScopeID());
1681-
InsertNewInstBefore(NewSI, *BBI);
1681+
InsertNewInstBefore(NewSI, BBI);
16821682
NewSI->setDebugLoc(MergedLoc);
16831683
NewSI->mergeDIAssignID({&SI, OtherStore});
16841684

llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ bool InstCombinerImpl::foldIntegerTypedPHI(PHINode &PN) {
248248
PHINode *NewPtrPHI = PHINode::Create(
249249
IntToPtr->getType(), PN.getNumIncomingValues(), PN.getName() + ".ptr");
250250

251-
InsertNewInstBefore(NewPtrPHI, PN);
251+
InsertNewInstBefore(NewPtrPHI, PN.getIterator());
252252
SmallDenseMap<Value *, Instruction *> Casts;
253253
for (auto Incoming : zip(PN.blocks(), AvailablePtrVals)) {
254254
auto *IncomingBB = std::get<0>(Incoming);
@@ -285,10 +285,10 @@ bool InstCombinerImpl::foldIntegerTypedPHI(PHINode &PN) {
285285
if (isa<PHINode>(IncomingI))
286286
InsertPos = BB->getFirstInsertionPt();
287287
assert(InsertPos != BB->end() && "should have checked above");
288-
InsertNewInstBefore(CI, *InsertPos);
288+
InsertNewInstBefore(CI, InsertPos);
289289
} else {
290290
auto *InsertBB = &IncomingBB->getParent()->getEntryBlock();
291-
InsertNewInstBefore(CI, *InsertBB->getFirstInsertionPt());
291+
InsertNewInstBefore(CI, InsertBB->getFirstInsertionPt());
292292
}
293293
}
294294
NewPtrPHI->addIncoming(CI, IncomingBB);
@@ -353,7 +353,7 @@ InstCombinerImpl::foldPHIArgInsertValueInstructionIntoPHI(PHINode &PN) {
353353
NewOperand->addIncoming(
354354
cast<InsertValueInst>(std::get<1>(Incoming))->getOperand(OpIdx),
355355
std::get<0>(Incoming));
356-
InsertNewInstBefore(NewOperand, PN);
356+
InsertNewInstBefore(NewOperand, PN.getIterator());
357357
}
358358

359359
// And finally, create `insertvalue` over the newly-formed PHI nodes.
@@ -391,7 +391,7 @@ InstCombinerImpl::foldPHIArgExtractValueInstructionIntoPHI(PHINode &PN) {
391391
NewAggregateOperand->addIncoming(
392392
cast<ExtractValueInst>(std::get<1>(Incoming))->getAggregateOperand(),
393393
std::get<0>(Incoming));
394-
InsertNewInstBefore(NewAggregateOperand, PN);
394+
InsertNewInstBefore(NewAggregateOperand, PN.getIterator());
395395

396396
// And finally, create `extractvalue` over the newly-formed PHI nodes.
397397
auto *NewEVI = ExtractValueInst::Create(NewAggregateOperand,
@@ -450,15 +450,15 @@ Instruction *InstCombinerImpl::foldPHIArgBinOpIntoPHI(PHINode &PN) {
450450
NewLHS = PHINode::Create(LHSType, PN.getNumIncomingValues(),
451451
FirstInst->getOperand(0)->getName() + ".pn");
452452
NewLHS->addIncoming(InLHS, PN.getIncomingBlock(0));
453-
InsertNewInstBefore(NewLHS, PN);
453+
InsertNewInstBefore(NewLHS, PN.getIterator());
454454
LHSVal = NewLHS;
455455
}
456456

457457
if (!RHSVal) {
458458
NewRHS = PHINode::Create(RHSType, PN.getNumIncomingValues(),
459459
FirstInst->getOperand(1)->getName() + ".pn");
460460
NewRHS->addIncoming(InRHS, PN.getIncomingBlock(0));
461-
InsertNewInstBefore(NewRHS, PN);
461+
InsertNewInstBefore(NewRHS, PN.getIterator());
462462
RHSVal = NewRHS;
463463
}
464464

@@ -581,7 +581,7 @@ Instruction *InstCombinerImpl::foldPHIArgGEPIntoPHI(PHINode &PN) {
581581
Value *FirstOp = FirstInst->getOperand(I);
582582
PHINode *NewPN =
583583
PHINode::Create(FirstOp->getType(), E, FirstOp->getName() + ".pn");
584-
InsertNewInstBefore(NewPN, PN);
584+
InsertNewInstBefore(NewPN, PN.getIterator());
585585

586586
NewPN->addIncoming(FirstOp, PN.getIncomingBlock(0));
587587
OperandPhis[I] = NewPN;
@@ -769,7 +769,7 @@ Instruction *InstCombinerImpl::foldPHIArgLoadIntoPHI(PHINode &PN) {
769769
NewLI->setOperand(0, InVal);
770770
delete NewPN;
771771
} else {
772-
InsertNewInstBefore(NewPN, PN);
772+
InsertNewInstBefore(NewPN, PN.getIterator());
773773
}
774774

775775
// If this was a volatile load that we are merging, make sure to loop through
@@ -853,7 +853,7 @@ Instruction *InstCombinerImpl::foldPHIArgZextsIntoPHI(PHINode &Phi) {
853853
for (unsigned I = 0; I != NumIncomingValues; ++I)
854854
NewPhi->addIncoming(NewIncoming[I], Phi.getIncomingBlock(I));
855855

856-
InsertNewInstBefore(NewPhi, Phi);
856+
InsertNewInstBefore(NewPhi, Phi.getIterator());
857857
return CastInst::CreateZExtOrBitCast(NewPhi, Phi.getType());
858858
}
859859

@@ -943,7 +943,7 @@ Instruction *InstCombinerImpl::foldPHIArgOpIntoPHI(PHINode &PN) {
943943
PhiVal = InVal;
944944
delete NewPN;
945945
} else {
946-
InsertNewInstBefore(NewPN, PN);
946+
InsertNewInstBefore(NewPN, PN.getIterator());
947947
PhiVal = NewPN;
948948
}
949949

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ static Instruction *foldSelectZeroOrMul(SelectInst &SI, InstCombinerImpl &IC) {
876876

877877
auto *FalseValI = cast<Instruction>(FalseVal);
878878
auto *FrY = IC.InsertNewInstBefore(new FreezeInst(Y, Y->getName() + ".fr"),
879-
*FalseValI);
879+
FalseValI->getIterator());
880880
IC.replaceOperand(*FalseValI, FalseValI->getOperand(0) == Y ? 0 : 1, FrY);
881881
return IC.replaceInstUsesWith(SI, FalseValI);
882882
}
@@ -3118,7 +3118,7 @@ Instruction *InstCombinerImpl::foldSelectOfBools(SelectInst &SI) {
31183118
Value *Op1 = IsAnd ? TrueVal : FalseVal;
31193119
if (isCheckForZeroAndMulWithOverflow(CondVal, Op1, IsAnd, Y)) {
31203120
auto *FI = new FreezeInst(*Y, (*Y)->getName() + ".fr");
3121-
InsertNewInstBefore(FI, *cast<Instruction>(Y->getUser()));
3121+
InsertNewInstBefore(FI, cast<Instruction>(Y->getUser())->getIterator());
31223122
replaceUse(*Y, FI);
31233123
return replaceInstUsesWith(SI, Op1);
31243124
}

llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,13 +709,13 @@ static Value *getShiftedValue(Value *V, unsigned NumBits, bool isLeftShift,
709709
case Instruction::Mul: {
710710
assert(!isLeftShift && "Unexpected shift direction!");
711711
auto *Neg = BinaryOperator::CreateNeg(I->getOperand(0));
712-
IC.InsertNewInstWith(Neg, *I);
712+
IC.InsertNewInstWith(Neg, I->getIterator());
713713
unsigned TypeWidth = I->getType()->getScalarSizeInBits();
714714
APInt Mask = APInt::getLowBitsSet(TypeWidth, TypeWidth - NumBits);
715715
auto *And = BinaryOperator::CreateAnd(Neg,
716716
ConstantInt::get(I->getType(), Mask));
717717
And->takeName(I);
718-
return IC.InsertNewInstWith(And, *I);
718+
return IC.InsertNewInstWith(And, I->getIterator());
719719
}
720720
}
721721
}

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
286286
Instruction *Or =
287287
BinaryOperator::CreateOr(I->getOperand(0), I->getOperand(1),
288288
I->getName());
289-
return InsertNewInstWith(Or, *I);
289+
return InsertNewInstWith(Or, I->getIterator());
290290
}
291291

292292
// If all of the demanded bits on one side are known, and all of the set
@@ -298,7 +298,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
298298
Constant *AndC = Constant::getIntegerValue(VTy,
299299
~RHSKnown.One & DemandedMask);
300300
Instruction *And = BinaryOperator::CreateAnd(I->getOperand(0), AndC);
301-
return InsertNewInstWith(And, *I);
301+
return InsertNewInstWith(And, I->getIterator());
302302
}
303303

304304
// If the RHS is a constant, see if we can change it. Don't alter a -1
@@ -330,11 +330,11 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
330330

331331
Constant *AndC = ConstantInt::get(VTy, NewMask & AndRHS->getValue());
332332
Instruction *NewAnd = BinaryOperator::CreateAnd(I->getOperand(0), AndC);
333-
InsertNewInstWith(NewAnd, *I);
333+
InsertNewInstWith(NewAnd, I->getIterator());
334334

335335
Constant *XorC = ConstantInt::get(VTy, NewMask & XorRHS->getValue());
336336
Instruction *NewXor = BinaryOperator::CreateXor(NewAnd, XorC);
337-
return InsertNewInstWith(NewXor, *I);
337+
return InsertNewInstWith(NewXor, I->getIterator());
338338
}
339339
}
340340
break;
@@ -462,7 +462,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
462462
DemandedMask.getActiveBits() <= SrcBitWidth) {
463463
// Convert to ZExt cast.
464464
CastInst *NewCast = new ZExtInst(I->getOperand(0), VTy, I->getName());
465-
return InsertNewInstWith(NewCast, *I);
465+
return InsertNewInstWith(NewCast, I->getIterator());
466466
}
467467

468468
// If the sign bit of the input is known set or clear, then we know the
@@ -586,7 +586,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
586586
if (match(I->getOperand(1), m_APInt(C)) && C->countr_zero() == CTZ) {
587587
Constant *ShiftC = ConstantInt::get(VTy, CTZ);
588588
Instruction *Shl = BinaryOperator::CreateShl(I->getOperand(0), ShiftC);
589-
return InsertNewInstWith(Shl, *I);
589+
return InsertNewInstWith(Shl, I->getIterator());
590590
}
591591
}
592592
// For a squared value "X * X", the bottom 2 bits are 0 and X[0] because:
@@ -595,7 +595,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
595595
if (I->getOperand(0) == I->getOperand(1) && DemandedMask.ult(4)) {
596596
Constant *One = ConstantInt::get(VTy, 1);
597597
Instruction *And1 = BinaryOperator::CreateAnd(I->getOperand(0), One);
598-
return InsertNewInstWith(And1, *I);
598+
return InsertNewInstWith(And1, I->getIterator());
599599
}
600600

601601
computeKnownBits(I, Known, Depth, CxtI);
@@ -627,7 +627,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
627627
Constant *NewC = ConstantExpr::getShl(C, LeftShiftAmtC);
628628
if (ConstantExpr::getLShr(NewC, LeftShiftAmtC) == C) {
629629
Instruction *Lshr = BinaryOperator::CreateLShr(NewC, X);
630-
return InsertNewInstWith(Lshr, *I);
630+
return InsertNewInstWith(Lshr, I->getIterator());
631631
}
632632
}
633633

@@ -691,7 +691,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
691691
Constant *NewC = ConstantExpr::getLShr(C, RightShiftAmtC);
692692
if (ConstantExpr::getShl(NewC, RightShiftAmtC) == C) {
693693
Instruction *Shl = BinaryOperator::CreateShl(NewC, X);
694-
return InsertNewInstWith(Shl, *I);
694+
return InsertNewInstWith(Shl, I->getIterator());
695695
}
696696
}
697697
}
@@ -733,7 +733,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
733733
// Perform the logical shift right.
734734
Instruction *NewVal = BinaryOperator::CreateLShr(
735735
I->getOperand(0), I->getOperand(1), I->getName());
736-
return InsertNewInstWith(NewVal, *I);
736+
return InsertNewInstWith(NewVal, I->getIterator());
737737
}
738738

739739
const APInt *SA;
@@ -770,7 +770,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
770770
BinaryOperator *LShr = BinaryOperator::CreateLShr(I->getOperand(0),
771771
I->getOperand(1));
772772
LShr->setIsExact(cast<BinaryOperator>(I)->isExact());
773-
return InsertNewInstWith(LShr, *I);
773+
return InsertNewInstWith(LShr, I->getIterator());
774774
} else if (Known.One[BitWidth-ShiftAmt-1]) { // New bits are known one.
775775
Known.One |= HighBits;
776776
}
@@ -867,7 +867,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
867867
match(II->getArgOperand(0), m_Not(m_Value(X)))) {
868868
Function *Ctpop = Intrinsic::getDeclaration(
869869
II->getModule(), Intrinsic::ctpop, VTy);
870-
return InsertNewInstWith(CallInst::Create(Ctpop, {X}), *I);
870+
return InsertNewInstWith(CallInst::Create(Ctpop, {X}), I->getIterator());
871871
}
872872
break;
873873
}
@@ -894,7 +894,7 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
894894
NewVal = BinaryOperator::CreateShl(
895895
II->getArgOperand(0), ConstantInt::get(VTy, NTZ - NLZ));
896896
NewVal->takeName(I);
897-
return InsertNewInstWith(NewVal, *I);
897+
return InsertNewInstWith(NewVal, I->getIterator());
898898
}
899899
break;
900900
}
@@ -1219,7 +1219,7 @@ Value *InstCombinerImpl::simplifyShrShlDemandedBits(
12191219
New->setIsExact(true);
12201220
}
12211221

1222-
return InsertNewInstWith(New, *Shl);
1222+
return InsertNewInstWith(New, Shl->getIterator());
12231223
}
12241224

12251225
return nullptr;
@@ -1549,7 +1549,7 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
15491549
Instruction *New = InsertElementInst::Create(
15501550
Op, Value, ConstantInt::get(Type::getInt64Ty(I->getContext()), Idx),
15511551
Shuffle->getName());
1552-
InsertNewInstWith(New, *Shuffle);
1552+
InsertNewInstWith(New, Shuffle->getIterator());
15531553
return New;
15541554
}
15551555
}

0 commit comments

Comments
 (0)