Skip to content

Commit

Permalink
[IR][NFC] Update IRBuilder to use InsertPosition (#96497)
Browse files Browse the repository at this point in the history
Uses the new InsertPosition class (added in #94226) to simplify some of
the IRBuilder interface, and removes the need to pass a BasicBlock
alongside a BasicBlock::iterator, using the fact that we can now get the
parent basic block from the iterator even if it points to the sentinel.
This patch removes the BasicBlock argument from each constructor or call
to setInsertPoint.

This has no functional effect, but later on as we look to remove the
`Instruction *InsertBefore` argument from instruction-creation
(discussed
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
this will simplify the process by allowing us to deprecate the
InsertPosition constructor directly and catch all the cases where we use
instructions rather than iterators.
  • Loading branch information
SLTozer committed Jun 24, 2024
1 parent 317277e commit 6481dc5
Show file tree
Hide file tree
Showing 97 changed files with 252 additions and 326 deletions.
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(
entry_ptr = entry_ptr->getNextNonDebugInstruction()->getIterator();
else
entry_ptr = entry->end();
Builder.SetInsertPoint(entry, entry_ptr);
Builder.SetInsertPoint(entry_ptr);

// Emit debug information for all the DeclRefExprs.
// FIXME: also for 'this'
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGGPUBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ RValue CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(const CallExpr *E) {
Args.push_back(Arg);
}

llvm::IRBuilder<> IRB(Builder.GetInsertBlock(), Builder.GetInsertPoint());
llvm::IRBuilder<> IRB(Builder.GetInsertPoint());
IRB.SetCurrentDebugLocation(Builder.getCurrentDebugLocation());

bool isBuffered = (CGM.getTarget().getTargetOpts().AMDGPUPrintfKindVal ==
clang::TargetOptions::AMDGPUPrintfKind::Buffered);
auto Printf = llvm::emitAMDGPUPrintfCall(IRB, Args, isBuffered);
Builder.SetInsertPoint(IRB.GetInsertBlock(), IRB.GetInsertPoint());
Builder.SetInsertPoint(IRB.GetInsertPoint());
return RValue::get(Printf);
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGHLSLRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
for (auto &F : M.functions()) {
if (!F.hasFnAttribute("hlsl.shader"))
continue;
IRBuilder<> B(&F.getEntryBlock(), F.getEntryBlock().begin());
IRBuilder<> B(F.getEntryBlock().begin());
for (auto *Fn : CtorFns)
B.CreateCall(FunctionCallee(Fn));

Expand Down
7 changes: 3 additions & 4 deletions clang/lib/CodeGen/CGObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2970,21 +2970,20 @@ static llvm::Value *emitARCOperationAfterCall(CodeGenFunction &CGF,
value = doFallback(CGF, value);
} else if (llvm::CallInst *call = dyn_cast<llvm::CallInst>(value)) {
// Place the retain immediately following the call.
CGF.Builder.SetInsertPoint(call->getParent(),
++llvm::BasicBlock::iterator(call));
CGF.Builder.SetInsertPoint(++llvm::BasicBlock::iterator(call));
value = doAfterCall(CGF, value);
} else if (llvm::InvokeInst *invoke = dyn_cast<llvm::InvokeInst>(value)) {
// Place the retain at the beginning of the normal destination block.
llvm::BasicBlock *BB = invoke->getNormalDest();
CGF.Builder.SetInsertPoint(BB, BB->begin());
CGF.Builder.SetInsertPoint(BB->begin());
value = doAfterCall(CGF, value);

// Bitcasts can arise because of related-result returns. Rewrite
// the operand.
} else if (llvm::BitCastInst *bitcast = dyn_cast<llvm::BitCastInst>(value)) {
// Change the insert point to avoid emitting the fall-back call after the
// bitcast.
CGF.Builder.SetInsertPoint(bitcast->getParent(), bitcast->getIterator());
CGF.Builder.SetInsertPoint(bitcast->getIterator());
llvm::Value *operand = bitcast->getOperand(0);
operand = emitARCOperationAfterCall(CGF, operand, doAfterCall, doFallback);
bitcast->setOperand(0, operand);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGObjCMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4417,7 +4417,7 @@ void FragileHazards::emitHazardsInNewBlocks() {
// call. If the call throws, then this is sufficient to
// guarantee correctness as long as it doesn't also write to any
// locals.
Builder.SetInsertPoint(&BB, BI);
Builder.SetInsertPoint(BI);
emitReadHazard(Builder);
}
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGOpenMPRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ llvm::Value *CGOpenMPRuntime::getThreadID(CodeGenFunction &CGF,
if (!Elem.second.ServiceInsertPt)
setLocThreadIdInsertPt(CGF);
CGBuilderTy::InsertPointGuard IPG(CGF.Builder);
CGF.Builder.SetInsertPoint(Elem.second.ServiceInsertPt);
CGF.Builder.SetInsertPoint(&*Elem.second.ServiceInsertPt);
auto DL = ApplyDebugLocation::CreateDefaultArtificial(CGF, Loc);
llvm::CallInst *Call = CGF.Builder.CreateCall(
OMPBuilder.getOrCreateRuntimeFunction(CGM.getModule(),
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3076,7 +3076,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
if (IsGCCAsmGoto && !CBRRegResults.empty()) {
for (llvm::BasicBlock *Succ : CBR->getIndirectDests()) {
llvm::IRBuilderBase::InsertPointGuard IPG(Builder);
Builder.SetInsertPoint(Succ, --(Succ->end()));
Builder.SetInsertPoint(--(Succ->end()));
EmitAsmStores(*this, S, CBRRegResults[Succ], ResultRegTypes,
ResultTruncRegTypes, ResultRegDests, ResultRegQualTys,
ResultTypeRequiresCast, ResultRegIsFlagReg);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CodeGenABITypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ llvm::Value *CodeGen::getCXXDestructorImplicitParam(
CGF.CurCodeDecl = D;
CGF.CurFuncDecl = D;
CGF.CurFn = InsertBlock->getParent();
CGF.Builder.SetInsertPoint(InsertBlock, InsertPoint);
CGF.Builder.SetInsertPoint(InsertPoint);
return CGM.getCXXABI().getCXXDestructorImplicitParam(
CGF, D, Type, ForVirtualBase, Delegating);
}
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CodeGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2764,7 +2764,7 @@ void CodeGenFunction::EmitSanitizerStatReport(llvm::SanitizerStatKind SSK) {
if (!CGM.getCodeGenOpts().SanitizeStats)
return;

llvm::IRBuilder<> IRB(Builder.GetInsertBlock(), Builder.GetInsertPoint());
llvm::IRBuilder<> IRB(Builder.GetInsertPoint());
IRB.SetCurrentDebugLocation(Builder.getCurrentDebugLocation());
CGM.getSanStats().create(IRB, SSK);
}
Expand Down Expand Up @@ -2883,7 +2883,7 @@ void CodeGenFunction::EmitAArch64MultiVersionResolver(
}

if (!AArch64CpuInitialized) {
Builder.SetInsertPoint(CurBlock, CurBlock->begin());
Builder.SetInsertPoint(CurBlock->begin());
EmitAArch64CpuInit();
AArch64CpuInitialized = true;
Builder.SetInsertPoint(CurBlock);
Expand Down
78 changes: 15 additions & 63 deletions llvm/include/llvm/IR/IRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,37 +173,13 @@ class IRBuilderBase {
BasicBlock::iterator GetInsertPoint() const { return InsertPt; }
LLVMContext &getContext() const { return Context; }

/// This specifies that created instructions should be appended to the
/// end of the specified block.
void SetInsertPoint(BasicBlock *TheBB) {
BB = TheBB;
InsertPt = BB->end();
}

/// This specifies that created instructions should be inserted before
/// the specified instruction.
void SetInsertPoint(Instruction *I) {
BB = I->getParent();
InsertPt = I->getIterator();
assert(InsertPt != BB->end() && "Can't read debug loc from end()");
SetCurrentDebugLocation(I->getStableDebugLoc());
}

/// This specifies that created instructions should be inserted at the
/// specified point.
void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP) {
BB = TheBB;
InsertPt = IP;
if (IP != TheBB->end())
SetCurrentDebugLocation(IP->getStableDebugLoc());
}

/// This specifies that created instructions should be inserted at
/// the specified point, but also requires that \p IP is dereferencable.
void SetInsertPoint(BasicBlock::iterator IP) {
BB = IP->getParent();
/// specified insert position.
void SetInsertPoint(InsertPosition IP) {
BB = IP.getBasicBlock();
InsertPt = IP;
SetCurrentDebugLocation(IP->getStableDebugLoc());
if (InsertPt != BB->end())
SetCurrentDebugLocation(InsertPt->getStableDebugLoc());
}

/// This specifies that created instructions should inserted at the beginning
Expand Down Expand Up @@ -286,7 +262,7 @@ class IRBuilderBase {
/// Sets the current insert point to a previously-saved location.
void restoreIP(InsertPoint IP) {
if (IP.isSet())
SetInsertPoint(IP.getBlock(), IP.getPoint());
SetInsertPoint(IP.getPoint());
else
ClearInsertionPoint();
}
Expand Down Expand Up @@ -2677,44 +2653,20 @@ class IRBuilder : public IRBuilderBase {
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
: IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles) {}

explicit IRBuilder(BasicBlock *TheBB, FolderTy Folder,
MDNode *FPMathTag = nullptr,
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
: IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
FPMathTag, OpBundles),
Folder(Folder) {
SetInsertPoint(TheBB);
}

explicit IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag = nullptr,
explicit IRBuilder(InsertPosition IP, MDNode *FPMathTag = nullptr,
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
: IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
FPMathTag, OpBundles) {
SetInsertPoint(TheBB);
}

explicit IRBuilder(Instruction *IP, MDNode *FPMathTag = nullptr,
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
: IRBuilderBase(IP->getContext(), this->Folder, this->Inserter, FPMathTag,
OpBundles) {
: IRBuilderBase(IP.getBasicBlock()->getContext(), this->Folder,
this->Inserter, FPMathTag, OpBundles) {
SetInsertPoint(IP);
}

IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, FolderTy Folder,
MDNode *FPMathTag = nullptr,
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
: IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
FPMathTag, OpBundles),
explicit IRBuilder(InsertPosition IP, FolderTy Folder,
MDNode *FPMathTag = nullptr,
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
: IRBuilderBase(IP.getBasicBlock()->getContext(), this->Folder,
this->Inserter, FPMathTag, OpBundles),
Folder(Folder) {
SetInsertPoint(TheBB, IP);
}

IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP,
MDNode *FPMathTag = nullptr,
ArrayRef<OperandBundleDef> OpBundles = std::nullopt)
: IRBuilderBase(TheBB->getContext(), this->Folder, this->Inserter,
FPMathTag, OpBundles) {
SetInsertPoint(TheBB, IP);
SetInsertPoint(IP);
}

/// Avoid copying the full IRBuilder. Prefer using InsertPointGuard
Expand Down
9 changes: 7 additions & 2 deletions llvm/include/llvm/IR/Instruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,20 @@ template <> struct ilist_alloc_traits<Instruction> {
iterator_range<simple_ilist<DbgRecord>::iterator>
getDbgRecordRange(DbgMarker *);

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

public:
InsertPosition(std::nullptr_t) : InsertAt() {}
// LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
// "BasicBlock::iterator")
InsertPosition(Instruction *InsertBefore);
InsertPosition(BasicBlock *InsertAtEnd);
InsertPosition(InstListType::iterator InsertAt) : InsertAt(InsertAt) {}
Expand Down
4 changes: 1 addition & 3 deletions llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,7 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
Builder.SetInsertPoint(IP);
}

void setInsertPoint(BasicBlock::iterator IP) {
Builder.SetInsertPoint(IP->getParent(), IP);
}
void setInsertPoint(BasicBlock::iterator IP) { Builder.SetInsertPoint(IP); }

/// Clear the current insertion point. This is useful if the instruction
/// that had been serving as the insertion point may have been deleted.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/MemoryBuiltins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ SizeOffsetValue ObjectSizeOffsetEvaluator::visitPHINode(PHINode &PHI) {
// Compute offset/size for each PHI incoming pointer.
for (unsigned i = 0, e = PHI.getNumIncomingValues(); i != e; ++i) {
BasicBlock *IncomingBlock = PHI.getIncomingBlock(i);
Builder.SetInsertPoint(IncomingBlock, IncomingBlock->getFirstInsertionPt());
Builder.SetInsertPoint(IncomingBlock->getFirstInsertionPt());
SizeOffsetValue EdgeData = compute_(PHI.getIncomingValue(i));

if (!EdgeData.bothKnown()) {
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/AtomicExpandPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ Value *AtomicExpandImpl::insertRMWLLSCLoop(
StoreSuccess, ConstantInt::get(IntegerType::get(Ctx, 32), 0), "tryagain");
Builder.CreateCondBr(TryAgain, LoopBB, ExitBB);

Builder.SetInsertPoint(ExitBB, ExitBB->begin());
Builder.SetInsertPoint(ExitBB->begin());
return Loaded;
}

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

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

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

Builder.CreateCondBr(Success, ExitBB, LoopBB);

Builder.SetInsertPoint(ExitBB, ExitBB->begin());
Builder.SetInsertPoint(ExitBB->begin());
return NewLoaded;
}

Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/CodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,7 @@ static bool despeculateCountZeros(IntrinsicInst *CountZeros,

// Create a PHI in the end block to select either the output of the intrinsic
// or the bit width of the operand.
Builder.SetInsertPoint(EndBlock, EndBlock->begin());
Builder.SetInsertPoint(EndBlock->begin());
PHINode *PN = Builder.CreatePHI(Ty, 2, "ctz");
replaceAllUsesWith(CountZeros, PN, FreshBBs, IsHugeFunc);
Value *BitWidth = Builder.getInt(APInt(SizeInBits, SizeInBits));
Expand Down Expand Up @@ -6306,7 +6306,7 @@ bool CodeGenPrepare::splitLargeGEPOffsets() {
NewBaseInsertBB = &BaseGEP->getFunction()->getEntryBlock();
NewBaseInsertPt = NewBaseInsertBB->getFirstInsertionPt();
}
IRBuilder<> NewBaseBuilder(NewBaseInsertBB, NewBaseInsertPt);
IRBuilder<> NewBaseBuilder(NewBaseInsertPt);
// Create a new base.
Value *BaseIndex = ConstantInt::get(PtrIdxTy, BaseOffset);
NewBaseGEP = OldBase;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/ExpandLargeFpConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static void expandFPToI(Instruction *FPToI) {
Builder.CreateBr(End);

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

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

// return:
Builder.SetInsertPoint(End, End->begin());
Builder.SetInsertPoint(End->begin());
PHINode *Retval0 = Builder.CreatePHI(IToFP->getType(), 2);
Retval0->addIncoming(A4, IfEnd26);
Retval0->addIncoming(ConstantFP::getZero(IToFP->getType(), false), Entry);
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/CodeGen/ExpandMemCmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ void MemCmpExpansion::emitMemCmpResultBlock() {
// need to be calculated and can simply return 1.
if (IsUsedForZeroCmp) {
BasicBlock::iterator InsertPt = ResBlock.BB->getFirstInsertionPt();
Builder.SetInsertPoint(ResBlock.BB, InsertPt);
Builder.SetInsertPoint(InsertPt);
Value *Res = ConstantInt::get(Type::getInt32Ty(CI->getContext()), 1);
PhiRes->addIncoming(Res, ResBlock.BB);
BranchInst *NewBr = BranchInst::Create(EndBlock);
Expand All @@ -584,7 +584,7 @@ void MemCmpExpansion::emitMemCmpResultBlock() {
return;
}
BasicBlock::iterator InsertPt = ResBlock.BB->getFirstInsertionPt();
Builder.SetInsertPoint(ResBlock.BB, InsertPt);
Builder.SetInsertPoint(InsertPt);

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

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

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/ExpandVectorPredication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ void CachingVPExpander::discardEVLParameter(VPIntrinsic &VPI) {
auto *M = VPI.getModule();
Function *VScaleFunc =
Intrinsic::getDeclaration(M, Intrinsic::vscale, Int32Ty);
IRBuilder<> Builder(VPI.getParent(), VPI.getIterator());
IRBuilder<> Builder(VPI.getIterator());
Value *FactorConst = Builder.getInt32(StaticElemCount.getKnownMinValue());
Value *VScale = Builder.CreateCall(VScaleFunc, {}, "vscale");
MaxEVL = Builder.CreateMul(VScale, FactorConst, "scalable_size",
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/HardwareLoops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ PHINode* HardwareLoop::InsertPHICounter(Value *NumElts, Value *EltsRem) {
BasicBlock *Preheader = L->getLoopPreheader();
BasicBlock *Header = L->getHeader();
BasicBlock *Latch = ExitBranch->getParent();
IRBuilder<> Builder(Header, Header->getFirstNonPHIIt());
IRBuilder<> Builder(Header->getFirstNonPHIIt());
PHINode *Index = Builder.CreatePHI(NumElts->getType(), 2);
Index->addIncoming(NumElts, Preheader);
Index->addIncoming(EltsRem, Latch);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/IntrinsicLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI,
FunctionCallee FCache =
M->getOrInsertFunction(NewFn, FunctionType::get(RetTy, ParamTys, false));

IRBuilder<> Builder(CI->getParent(), CI->getIterator());
IRBuilder<> Builder(CI->getIterator());
SmallVector<Value *, 8> Args(ArgBegin, ArgEnd);
CallInst *NewCI = Builder.CreateCall(FCache, Args);
NewCI->setName(CI->getName());
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static bool lowerObjCCall(Function &F, const char *NewFn,
auto *CI = cast<CallInst>(CB);
assert(CI->getCalledFunction() && "Cannot lower an indirect call!");

IRBuilder<> Builder(CI->getParent(), CI->getIterator());
IRBuilder<> Builder(CI->getIterator());
SmallVector<Value *, 8> Args(CI->args());
SmallVector<llvm::OperandBundleDef, 1> BundleList;
CI->getOperandBundlesAsDefs(BundleList);
Expand Down
Loading

0 comments on commit 6481dc5

Please sign in to comment.