Skip to content

Commit d75f9dd

Browse files
committed
Revert "[IR][NFC] Update IRBuilder to use InsertPosition (llvm#96497)"
Reverts the above commit, as it updates a common header function and did not update all callsites: https://lab.llvm.org/buildbot/#/builders/29/builds/382 This reverts commit 6481dc5.
1 parent 3b5b814 commit d75f9dd

File tree

97 files changed

+326
-252
lines changed

Some content is hidden

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

97 files changed

+326
-252
lines changed

clang/lib/CodeGen/CGBlocks.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(
15451545
entry_ptr = entry_ptr->getNextNonDebugInstruction()->getIterator();
15461546
else
15471547
entry_ptr = entry->end();
1548-
Builder.SetInsertPoint(entry_ptr);
1548+
Builder.SetInsertPoint(entry, entry_ptr);
15491549

15501550
// Emit debug information for all the DeclRefExprs.
15511551
// FIXME: also for 'this'

clang/lib/CodeGen/CGGPUBuiltin.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@ RValue CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(const CallExpr *E) {
202202
Args.push_back(Arg);
203203
}
204204

205-
llvm::IRBuilder<> IRB(Builder.GetInsertPoint());
205+
llvm::IRBuilder<> IRB(Builder.GetInsertBlock(), Builder.GetInsertPoint());
206206
IRB.SetCurrentDebugLocation(Builder.getCurrentDebugLocation());
207207

208208
bool isBuffered = (CGM.getTarget().getTargetOpts().AMDGPUPrintfKindVal ==
209209
clang::TargetOptions::AMDGPUPrintfKind::Buffered);
210210
auto Printf = llvm::emitAMDGPUPrintfCall(IRB, Args, isBuffered);
211-
Builder.SetInsertPoint(IRB.GetInsertPoint());
211+
Builder.SetInsertPoint(IRB.GetInsertBlock(), IRB.GetInsertPoint());
212212
return RValue::get(Printf);
213213
}
214214

clang/lib/CodeGen/CGHLSLRuntime.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
436436
for (auto &F : M.functions()) {
437437
if (!F.hasFnAttribute("hlsl.shader"))
438438
continue;
439-
IRBuilder<> B(F.getEntryBlock().begin());
439+
IRBuilder<> B(&F.getEntryBlock(), F.getEntryBlock().begin());
440440
for (auto *Fn : CtorFns)
441441
B.CreateCall(FunctionCallee(Fn));
442442

clang/lib/CodeGen/CGObjC.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -2970,20 +2970,21 @@ static llvm::Value *emitARCOperationAfterCall(CodeGenFunction &CGF,
29702970
value = doFallback(CGF, value);
29712971
} else if (llvm::CallInst *call = dyn_cast<llvm::CallInst>(value)) {
29722972
// Place the retain immediately following the call.
2973-
CGF.Builder.SetInsertPoint(++llvm::BasicBlock::iterator(call));
2973+
CGF.Builder.SetInsertPoint(call->getParent(),
2974+
++llvm::BasicBlock::iterator(call));
29742975
value = doAfterCall(CGF, value);
29752976
} else if (llvm::InvokeInst *invoke = dyn_cast<llvm::InvokeInst>(value)) {
29762977
// Place the retain at the beginning of the normal destination block.
29772978
llvm::BasicBlock *BB = invoke->getNormalDest();
2978-
CGF.Builder.SetInsertPoint(BB->begin());
2979+
CGF.Builder.SetInsertPoint(BB, BB->begin());
29792980
value = doAfterCall(CGF, value);
29802981

29812982
// Bitcasts can arise because of related-result returns. Rewrite
29822983
// the operand.
29832984
} else if (llvm::BitCastInst *bitcast = dyn_cast<llvm::BitCastInst>(value)) {
29842985
// Change the insert point to avoid emitting the fall-back call after the
29852986
// bitcast.
2986-
CGF.Builder.SetInsertPoint(bitcast->getIterator());
2987+
CGF.Builder.SetInsertPoint(bitcast->getParent(), bitcast->getIterator());
29872988
llvm::Value *operand = bitcast->getOperand(0);
29882989
operand = emitARCOperationAfterCall(CGF, operand, doAfterCall, doFallback);
29892990
bitcast->setOperand(0, operand);

clang/lib/CodeGen/CGObjCMac.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4417,7 +4417,7 @@ void FragileHazards::emitHazardsInNewBlocks() {
44174417
// call. If the call throws, then this is sufficient to
44184418
// guarantee correctness as long as it doesn't also write to any
44194419
// locals.
4420-
Builder.SetInsertPoint(BI);
4420+
Builder.SetInsertPoint(&BB, BI);
44214421
emitReadHazard(Builder);
44224422
}
44234423
}

clang/lib/CodeGen/CGOpenMPRuntime.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ llvm::Value *CGOpenMPRuntime::getThreadID(CodeGenFunction &CGF,
14471447
if (!Elem.second.ServiceInsertPt)
14481448
setLocThreadIdInsertPt(CGF);
14491449
CGBuilderTy::InsertPointGuard IPG(CGF.Builder);
1450-
CGF.Builder.SetInsertPoint(&*Elem.second.ServiceInsertPt);
1450+
CGF.Builder.SetInsertPoint(Elem.second.ServiceInsertPt);
14511451
auto DL = ApplyDebugLocation::CreateDefaultArtificial(CGF, Loc);
14521452
llvm::CallInst *Call = CGF.Builder.CreateCall(
14531453
OMPBuilder.getOrCreateRuntimeFunction(CGM.getModule(),

clang/lib/CodeGen/CGStmt.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3076,7 +3076,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
30763076
if (IsGCCAsmGoto && !CBRRegResults.empty()) {
30773077
for (llvm::BasicBlock *Succ : CBR->getIndirectDests()) {
30783078
llvm::IRBuilderBase::InsertPointGuard IPG(Builder);
3079-
Builder.SetInsertPoint(--(Succ->end()));
3079+
Builder.SetInsertPoint(Succ, --(Succ->end()));
30803080
EmitAsmStores(*this, S, CBRRegResults[Succ], ResultRegTypes,
30813081
ResultTruncRegTypes, ResultRegDests, ResultRegQualTys,
30823082
ResultTypeRequiresCast, ResultRegIsFlagReg);

clang/lib/CodeGen/CodeGenABITypes.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ llvm::Value *CodeGen::getCXXDestructorImplicitParam(
123123
CGF.CurCodeDecl = D;
124124
CGF.CurFuncDecl = D;
125125
CGF.CurFn = InsertBlock->getParent();
126-
CGF.Builder.SetInsertPoint(InsertPoint);
126+
CGF.Builder.SetInsertPoint(InsertBlock, InsertPoint);
127127
return CGM.getCXXABI().getCXXDestructorImplicitParam(
128128
CGF, D, Type, ForVirtualBase, Delegating);
129129
}

clang/lib/CodeGen/CodeGenFunction.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,7 @@ void CodeGenFunction::EmitSanitizerStatReport(llvm::SanitizerStatKind SSK) {
27642764
if (!CGM.getCodeGenOpts().SanitizeStats)
27652765
return;
27662766

2767-
llvm::IRBuilder<> IRB(Builder.GetInsertPoint());
2767+
llvm::IRBuilder<> IRB(Builder.GetInsertBlock(), Builder.GetInsertPoint());
27682768
IRB.SetCurrentDebugLocation(Builder.getCurrentDebugLocation());
27692769
CGM.getSanStats().create(IRB, SSK);
27702770
}
@@ -2883,7 +2883,7 @@ void CodeGenFunction::EmitAArch64MultiVersionResolver(
28832883
}
28842884

28852885
if (!AArch64CpuInitialized) {
2886-
Builder.SetInsertPoint(CurBlock->begin());
2886+
Builder.SetInsertPoint(CurBlock, CurBlock->begin());
28872887
EmitAArch64CpuInit();
28882888
AArch64CpuInitialized = true;
28892889
Builder.SetInsertPoint(CurBlock);

llvm/include/llvm/IR/IRBuilder.h

+63-15
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,37 @@ class IRBuilderBase {
173173
BasicBlock::iterator GetInsertPoint() const { return InsertPt; }
174174
LLVMContext &getContext() const { return Context; }
175175

176+
/// This specifies that created instructions should be appended to the
177+
/// end of the specified block.
178+
void SetInsertPoint(BasicBlock *TheBB) {
179+
BB = TheBB;
180+
InsertPt = BB->end();
181+
}
182+
183+
/// This specifies that created instructions should be inserted before
184+
/// the specified instruction.
185+
void SetInsertPoint(Instruction *I) {
186+
BB = I->getParent();
187+
InsertPt = I->getIterator();
188+
assert(InsertPt != BB->end() && "Can't read debug loc from end()");
189+
SetCurrentDebugLocation(I->getStableDebugLoc());
190+
}
191+
176192
/// This specifies that created instructions should be inserted at the
177-
/// specified insert position.
178-
void SetInsertPoint(InsertPosition IP) {
179-
BB = IP.getBasicBlock();
193+
/// specified point.
194+
void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP) {
195+
BB = TheBB;
196+
InsertPt = IP;
197+
if (IP != TheBB->end())
198+
SetCurrentDebugLocation(IP->getStableDebugLoc());
199+
}
200+
201+
/// This specifies that created instructions should be inserted at
202+
/// the specified point, but also requires that \p IP is dereferencable.
203+
void SetInsertPoint(BasicBlock::iterator IP) {
204+
BB = IP->getParent();
180205
InsertPt = IP;
181-
if (InsertPt != BB->end())
182-
SetCurrentDebugLocation(InsertPt->getStableDebugLoc());
206+
SetCurrentDebugLocation(IP->getStableDebugLoc());
183207
}
184208

185209
/// This specifies that created instructions should inserted at the beginning
@@ -262,7 +286,7 @@ class IRBuilderBase {
262286
/// Sets the current insert point to a previously-saved location.
263287
void restoreIP(InsertPoint IP) {
264288
if (IP.isSet())
265-
SetInsertPoint(IP.getPoint());
289+
SetInsertPoint(IP.getBlock(), IP.getPoint());
266290
else
267291
ClearInsertionPoint();
268292
}
@@ -2653,22 +2677,46 @@ class IRBuilder : public IRBuilderBase {
26532677
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
26542678
: IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles) {}
26552679

2656-
explicit IRBuilder(InsertPosition IP, MDNode *FPMathTag = nullptr,
2680+
explicit IRBuilder(BasicBlock *TheBB, FolderTy Folder,
2681+
MDNode *FPMathTag = nullptr,
26572682
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
2658-
: IRBuilderBase(IP.getBasicBlock()->getContext(), this->Folder,
2659-
this->Inserter, FPMathTag, OpBundles) {
2660-
SetInsertPoint(IP);
2683+
: IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
2684+
FPMathTag, OpBundles),
2685+
Folder(Folder) {
2686+
SetInsertPoint(TheBB);
26612687
}
26622688

2663-
explicit IRBuilder(InsertPosition IP, FolderTy Folder,
2664-
MDNode *FPMathTag = nullptr,
2689+
explicit IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag = nullptr,
26652690
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
2666-
: IRBuilderBase(IP.getBasicBlock()->getContext(), this->Folder,
2667-
this->Inserter, FPMathTag, OpBundles),
2668-
Folder(Folder) {
2691+
: IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
2692+
FPMathTag, OpBundles) {
2693+
SetInsertPoint(TheBB);
2694+
}
2695+
2696+
explicit IRBuilder(Instruction *IP, MDNode *FPMathTag = nullptr,
2697+
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
2698+
: IRBuilderBase(IP->getContext(), this->Folder, this->Inserter, FPMathTag,
2699+
OpBundles) {
26692700
SetInsertPoint(IP);
26702701
}
26712702

2703+
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, FolderTy Folder,
2704+
MDNode *FPMathTag = nullptr,
2705+
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
2706+
: IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
2707+
FPMathTag, OpBundles),
2708+
Folder(Folder) {
2709+
SetInsertPoint(TheBB, IP);
2710+
}
2711+
2712+
IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP,
2713+
MDNode *FPMathTag = nullptr,
2714+
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
2715+
: IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
2716+
FPMathTag, OpBundles) {
2717+
SetInsertPoint(TheBB, IP);
2718+
}
2719+
26722720
/// Avoid copying the full IRBuilder. Prefer using InsertPointGuard
26732721
/// or FastMathFlagGuard instead.
26742722
IRBuilder(const IRBuilder &) = delete;

llvm/include/llvm/IR/Instruction.h

+2-7
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,15 @@ template <> struct ilist_alloc_traits<Instruction> {
4444
iterator_range<simple_ilist<DbgRecord>::iterator>
4545
getDbgRecordRange(DbgMarker *);
4646

47-
/// Class used to generate an insert position (ultimately always a
48-
/// BasicBlock::iterator, which it will implicitly convert to) from either:
49-
/// - An Instruction, inserting immediately prior. This will soon be marked as
50-
/// deprecated.
51-
/// - A BasicBlock, inserting at the end.
52-
/// - An iterator, inserting at its position.
53-
/// - Any nullptr value, giving a blank iterator (not valid for insertion).
5447
class InsertPosition {
5548
using InstListType = SymbolTableList<Instruction, ilist_iterator_bits<true>,
5649
ilist_parent<BasicBlock>>;
5750
InstListType::iterator InsertAt;
5851

5952
public:
6053
InsertPosition(std::nullptr_t) : InsertAt() {}
54+
// LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
55+
// "BasicBlock::iterator")
6156
InsertPosition(Instruction *InsertBefore);
6257
InsertPosition(BasicBlock *InsertAtEnd);
6358
InsertPosition(InstListType::iterator InsertAt) : InsertAt(InsertAt) {}

llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,9 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
376376
Builder.SetInsertPoint(IP);
377377
}
378378

379-
void setInsertPoint(BasicBlock::iterator IP) { Builder.SetInsertPoint(IP); }
379+
void setInsertPoint(BasicBlock::iterator IP) {
380+
Builder.SetInsertPoint(IP->getParent(), IP);
381+
}
380382

381383
/// Clear the current insertion point. This is useful if the instruction
382384
/// that had been serving as the insertion point may have been deleted.

llvm/lib/Analysis/MemoryBuiltins.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ SizeOffsetValue ObjectSizeOffsetEvaluator::visitPHINode(PHINode &PHI) {
12171217
// Compute offset/size for each PHI incoming pointer.
12181218
for (unsigned i = 0, e = PHI.getNumIncomingValues(); i != e; ++i) {
12191219
BasicBlock *IncomingBlock = PHI.getIncomingBlock(i);
1220-
Builder.SetInsertPoint(IncomingBlock->getFirstInsertionPt());
1220+
Builder.SetInsertPoint(IncomingBlock, IncomingBlock->getFirstInsertionPt());
12211221
SizeOffsetValue EdgeData = compute_(PHI.getIncomingValue(i));
12221222

12231223
if (!EdgeData.bothKnown()) {

llvm/lib/CodeGen/AtomicExpandPass.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ Value *AtomicExpandImpl::insertRMWLLSCLoop(
12421242
StoreSuccess, ConstantInt::get(IntegerType::get(Ctx, 32), 0), "tryagain");
12431243
Builder.CreateCondBr(TryAgain, LoopBB, ExitBB);
12441244

1245-
Builder.SetInsertPoint(ExitBB->begin());
1245+
Builder.SetInsertPoint(ExitBB, ExitBB->begin());
12461246
return Loaded;
12471247
}
12481248

@@ -1478,7 +1478,7 @@ bool AtomicExpandImpl::expandAtomicCmpXchg(AtomicCmpXchgInst *CI) {
14781478
// succeeded or not. We expose this to later passes by converting any
14791479
// subsequent "icmp eq/ne %loaded, %oldval" into a use of an appropriate
14801480
// PHI.
1481-
Builder.SetInsertPoint(ExitBB->begin());
1481+
Builder.SetInsertPoint(ExitBB, ExitBB->begin());
14821482
PHINode *LoadedExit =
14831483
Builder.CreatePHI(UnreleasedLoad->getType(), 2, "loaded.exit");
14841484
LoadedExit->addIncoming(LoadedTryStore, SuccessBB);
@@ -1491,7 +1491,7 @@ bool AtomicExpandImpl::expandAtomicCmpXchg(AtomicCmpXchgInst *CI) {
14911491
// a type wider than the one in the cmpxchg instruction.
14921492
Value *LoadedFull = LoadedExit;
14931493

1494-
Builder.SetInsertPoint(std::next(Success->getIterator()));
1494+
Builder.SetInsertPoint(ExitBB, std::next(Success->getIterator()));
14951495
Value *Loaded = extractMaskedValue(Builder, LoadedFull, PMV);
14961496

14971497
// Look for any users of the cmpxchg that are just comparing the loaded value
@@ -1616,7 +1616,7 @@ Value *AtomicExpandImpl::insertRMWCmpXchgLoop(
16161616

16171617
Builder.CreateCondBr(Success, ExitBB, LoopBB);
16181618

1619-
Builder.SetInsertPoint(ExitBB->begin());
1619+
Builder.SetInsertPoint(ExitBB, ExitBB->begin());
16201620
return NewLoaded;
16211621
}
16221622

llvm/lib/CodeGen/CodeGenPrepare.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,7 @@ static bool despeculateCountZeros(IntrinsicInst *CountZeros,
23552355

23562356
// Create a PHI in the end block to select either the output of the intrinsic
23572357
// or the bit width of the operand.
2358-
Builder.SetInsertPoint(EndBlock->begin());
2358+
Builder.SetInsertPoint(EndBlock, EndBlock->begin());
23592359
PHINode *PN = Builder.CreatePHI(Ty, 2, "ctz");
23602360
replaceAllUsesWith(CountZeros, PN, FreshBBs, IsHugeFunc);
23612361
Value *BitWidth = Builder.getInt(APInt(SizeInBits, SizeInBits));
@@ -6306,7 +6306,7 @@ bool CodeGenPrepare::splitLargeGEPOffsets() {
63066306
NewBaseInsertBB = &BaseGEP->getFunction()->getEntryBlock();
63076307
NewBaseInsertPt = NewBaseInsertBB->getFirstInsertionPt();
63086308
}
6309-
IRBuilder<> NewBaseBuilder(NewBaseInsertPt);
6309+
IRBuilder<> NewBaseBuilder(NewBaseInsertBB, NewBaseInsertPt);
63106310
// Create a new base.
63116311
Value *BaseIndex = ConstantInt::get(PtrIdxTy, BaseOffset);
63126312
NewBaseGEP = OldBase;

llvm/lib/CodeGen/ExpandLargeFpConvert.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static void expandFPToI(Instruction *FPToI) {
212212
Builder.CreateBr(End);
213213

214214
// cleanup:
215-
Builder.SetInsertPoint(End->begin());
215+
Builder.SetInsertPoint(End, End->begin());
216216
PHINode *Retval0 = Builder.CreatePHI(FPToI->getType(), 4);
217217

218218
Retval0->addIncoming(Cond8, IfThen5);
@@ -560,7 +560,7 @@ static void expandIToFP(Instruction *IToFP) {
560560
Builder.CreateBr(End);
561561

562562
// return:
563-
Builder.SetInsertPoint(End->begin());
563+
Builder.SetInsertPoint(End, End->begin());
564564
PHINode *Retval0 = Builder.CreatePHI(IToFP->getType(), 2);
565565
Retval0->addIncoming(A4, IfEnd26);
566566
Retval0->addIncoming(ConstantFP::getZero(IToFP->getType(), false), Entry);

llvm/lib/CodeGen/ExpandMemCmp.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ void MemCmpExpansion::emitMemCmpResultBlock() {
574574
// need to be calculated and can simply return 1.
575575
if (IsUsedForZeroCmp) {
576576
BasicBlock::iterator InsertPt = ResBlock.BB->getFirstInsertionPt();
577-
Builder.SetInsertPoint(InsertPt);
577+
Builder.SetInsertPoint(ResBlock.BB, InsertPt);
578578
Value *Res = ConstantInt::get(Type::getInt32Ty(CI->getContext()), 1);
579579
PhiRes->addIncoming(Res, ResBlock.BB);
580580
BranchInst *NewBr = BranchInst::Create(EndBlock);
@@ -584,7 +584,7 @@ void MemCmpExpansion::emitMemCmpResultBlock() {
584584
return;
585585
}
586586
BasicBlock::iterator InsertPt = ResBlock.BB->getFirstInsertionPt();
587-
Builder.SetInsertPoint(InsertPt);
587+
Builder.SetInsertPoint(ResBlock.BB, InsertPt);
588588

589589
Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_ULT, ResBlock.PhiSrc1,
590590
ResBlock.PhiSrc2);
@@ -611,7 +611,7 @@ void MemCmpExpansion::setupResultBlockPHINodes() {
611611
}
612612

613613
void MemCmpExpansion::setupEndBlockPHINodes() {
614-
Builder.SetInsertPoint(EndBlock->begin());
614+
Builder.SetInsertPoint(EndBlock, EndBlock->begin());
615615
PhiRes = Builder.CreatePHI(Type::getInt32Ty(CI->getContext()), 2, "phi.res");
616616
}
617617

llvm/lib/CodeGen/ExpandVectorPredication.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ void CachingVPExpander::discardEVLParameter(VPIntrinsic &VPI) {
667667
auto *M = VPI.getModule();
668668
Function *VScaleFunc =
669669
Intrinsic::getDeclaration(M, Intrinsic::vscale, Int32Ty);
670-
IRBuilder<> Builder(VPI.getIterator());
670+
IRBuilder<> Builder(VPI.getParent(), VPI.getIterator());
671671
Value *FactorConst = Builder.getInt32(StaticElemCount.getKnownMinValue());
672672
Value *VScale = Builder.CreateCall(VScaleFunc, {}, "vscale");
673673
MaxEVL = Builder.CreateMul(VScale, FactorConst, "scalable_size",

llvm/lib/CodeGen/HardwareLoops.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ PHINode* HardwareLoop::InsertPHICounter(Value *NumElts, Value *EltsRem) {
580580
BasicBlock *Preheader = L->getLoopPreheader();
581581
BasicBlock *Header = L->getHeader();
582582
BasicBlock *Latch = ExitBranch->getParent();
583-
IRBuilder<> Builder(Header->getFirstNonPHIIt());
583+
IRBuilder<> Builder(Header, Header->getFirstNonPHIIt());
584584
PHINode *Index = Builder.CreatePHI(NumElts->getType(), 2);
585585
Index->addIncoming(NumElts, Preheader);
586586
Index->addIncoming(EltsRem, Latch);

llvm/lib/CodeGen/IntrinsicLowering.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI,
4040
FunctionCallee FCache =
4141
M->getOrInsertFunction(NewFn, FunctionType::get(RetTy, ParamTys, false));
4242

43-
IRBuilder<> Builder(CI->getIterator());
43+
IRBuilder<> Builder(CI->getParent(), CI->getIterator());
4444
SmallVector<Value *, 8> Args(ArgBegin, ArgEnd);
4545
CallInst *NewCI = Builder.CreateCall(FCache, Args);
4646
NewCI->setName(CI->getName());

llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static bool lowerObjCCall(Function &F, const char *NewFn,
144144
auto *CI = cast<CallInst>(CB);
145145
assert(CI->getCalledFunction() && "Cannot lower an indirect call!");
146146

147-
IRBuilder<> Builder(CI->getIterator());
147+
IRBuilder<> Builder(CI->getParent(), CI->getIterator());
148148
SmallVector<Value *, 8> Args(CI->args());
149149
SmallVector<llvm::OperandBundleDef, 1> BundleList;
150150
CI->getOperandBundlesAsDefs(BundleList);

0 commit comments

Comments
 (0)