Skip to content

[SYCL][NFC] Stop using deprecated InsertionPoint constructor #16658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,8 @@ optimizeFunction(Function *OldF,
// preserve data flow equality to the original.
unsigned OldArgNo = PI.getFormalParam().getArgNo();
unsigned NewArgNo = oldArgNo2NewArgNo(OldArgNo, SretInd);
Instruction *At = nullptr;
Value *Val = NewF->getArg(NewArgNo);
StoreInst *St = new StoreInst(Val, Alloca, false, Al, At);
StoreInst *St = new StoreInst(Val, Alloca, false, Al);
NewInsts.push_back(St);
}
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ static Instruction *addCastInstIfNeeded(Instruction *OldI, Instruction *NewI,
if (OITy != NITy) {
auto CastOpcode = CastInst::getCastOpcode(NewI, false, OITy, false);
NewI = CastInst::Create(CastOpcode, NewI, OITy,
NewI->getName() + ".cast.ty", OldI);
NewI->getName() + ".cast.ty", OldI->getIterator());
NewI->setDebugLoc(OldI->getDebugLoc());
}
return NewI;
Expand Down Expand Up @@ -1565,7 +1565,7 @@ static void translateESIMDIntrinsicCall(CallInst &CI) {
CallInst *NewCI = IntrinsicInst::Create(
NewFDecl, GenXArgs,
NewFDecl->getReturnType()->isVoidTy() ? "" : CI.getName() + ".esimd",
&CI);
CI.getIterator());
NewCI->setDebugLoc(CI.getDebugLoc());
if (DoesFunctionReturnStructure) {
IRBuilder<> Builder(&CI);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLLowerIR/GlobalOffset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void GlobalOffsetPass::addImplicitParameterToCallers(
/* Func= */ CalleeWithImplicitParam,
/* Args= */ ImplicitOffsets,
/* NameStr= */ Twine(),
/* InsertBefore= */ CallToOld);
/* InsertBefore= */ CallToOld->getIterator());
NewCallInst->setTailCallKind(CallToOld->getTailCallKind());
NewCallInst->copyMetadata(*CallToOld);
CallToOld->replaceAllUsesWith(NewCallInst);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLLowerIR/LocalAccessorToSharedMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Function *LocalAccessorToSharedMemoryPass::processKernel(Module &M,
ConstantInt::get(Type::getInt32Ty(M.getContext()), 0, false),
NFA,
},
/* NameStr= */ Twine{NFA->getName()}, InsertBefore);
/* NameStr= */ Twine{NFA->getName()}, InsertBefore->getIterator());
// Then create a bitcast to make sure the new pointer is the same type
// as the old one. This will only ever be a `i8 addrspace(3)*` to `i32
// addrspace(3)*` type of cast.
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/SYCLLowerIR/LowerInvokeSimd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ bool processInvokeSimdCall(CallInst *InvokeSimd,
NewInvokeSimdArgs.push_back(NewHelper);
auto ThirdArg = std::next(InvokeSimd->arg_begin(), 2);
NewInvokeSimdArgs.append(ThirdArg, InvokeSimd->arg_end());
CallInst *NewInvokeSimd =
CallInst::Create(NewInvokeSimdF, NewInvokeSimdArgs, "", InvokeSimd);
CallInst *NewInvokeSimd = CallInst::Create(
NewInvokeSimdF, NewInvokeSimdArgs, "", InvokeSimd->getIterator());
// - transfer flags, attributes (with shrinking), calling convention:
NewInvokeSimd->copyIRFlags(InvokeSimd);
NewInvokeSimd->setCallingConv(InvokeSimd->getCallingConv());
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLLowerIR/LowerWGScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ Value *spirv::genPseudoLocalID(Instruction &Before, const Triple &TT) {
Align Alignment = M.getDataLayout().getPreferredAlign(G);
G->setAlignment(MaybeAlign(Alignment));
}
Value *Res = new LoadInst(G->getValueType(), G, "", &Before);
Value *Res = new LoadInst(G->getValueType(), G, "", Before.getIterator());
return Res;
}
}
Expand Down
24 changes: 12 additions & 12 deletions llvm/lib/SYCLLowerIR/SpecConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,15 @@ Instruction *emitCall(Type *RetTy, StringRef BaseFunctionName,
auto *NewFT = FunctionType::get(NewRetTy, ArgTys, false /*isVarArg*/);
auto NewFC = M->getOrInsertFunction(FunctionName, NewFT);

auto *Call =
CallInst::Create(NewFT, NewFC.getCallee(), Args, "", InsertBefore);
auto *Call = CallInst::Create(NewFT, NewFC.getCallee(), Args, "",
InsertBefore->getIterator());
if (IsSPIROrSPIRV) {
cast<Function>(NewFC.getCallee())
->setCallingConv(CallingConv::SPIR_FUNC);
Call->setCallingConv(CallingConv::SPIR_FUNC);
}
return CastInst::CreateTruncOrBitCast(Call, RetTy, "tobool",
InsertBefore);
InsertBefore->getIterator());
}
}

Expand Down Expand Up @@ -711,22 +711,22 @@ Value *createLoadFromBuffer(CallInst *InsertBefore, Value *Buffer,
Type *Int32Ty = Type::getInt32Ty(C);
GetElementPtrInst *GEP = GetElementPtrInst::Create(
Int8Ty, Buffer, {ConstantInt::get(Int32Ty, Offset, false)}, "gep",
InsertBefore);
InsertBefore->getIterator());

Instruction *BitCast = nullptr;
if (SCType->isIntegerTy(1)) // No bitcast to i1 before load
BitCast = GEP;
else
BitCast =
new BitCastInst(GEP, PointerType::get(SCType, GEP->getAddressSpace()),
"bc", InsertBefore);
"bc", InsertBefore->getIterator());

// When we encounter i1 spec constant, we still load the whole byte
Value *Load = new LoadInst(SCType->isIntegerTy(1) ? Int8Ty : SCType, BitCast,
"load", InsertBefore);
"load", InsertBefore->getIterator());
if (SCType->isIntegerTy(1)) // trunc back to i1 if necessary
Load = CastInst::CreateIntegerCast(Load, SCType, /* IsSigned */ false,
"tobool", InsertBefore);
"tobool", InsertBefore->getIterator());

return Load;
}
Expand Down Expand Up @@ -993,8 +993,8 @@ PreservedAnalyses SpecConstantsPass::run(Module &M,
if (SCTy->isIntegerTy(1)) {
assert(DefaultValue->getType()->isIntegerTy(8) &&
"For bool spec constant default value is expected to be i8");
Replacement =
new TruncInst(DefaultValue, Type::getInt1Ty(Ctx), "bool", CI);
Replacement = new TruncInst(DefaultValue, Type::getInt1Ty(Ctx),
"bool", CI->getIterator());
} else
Replacement = DefaultValue;
}
Expand All @@ -1021,9 +1021,9 @@ PreservedAnalyses SpecConstantsPass::run(Module &M,
Value *ArraySize =
Mode == HandlingMode::emulation ? DefaultValue : Replacement;
assert(ArraySize->getType()->isIntegerTy() && "Expecting integer type");
Replacement =
new AllocaInst(Intr->getAllocatedType(), Intr->getAddressSpace(),
ArraySize, Intr->getAlign(), "alloca", CI);
Replacement = new AllocaInst(
Intr->getAllocatedType(), Intr->getAddressSpace(), ArraySize,
Intr->getAlign(), "alloca", CI->getIterator());
}

if (HasSretParameter)
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/SYCLNativeCPUUtils/PrepareSYCLNativeCPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ PreservedAnalyses PrepareSYCLNativeCPUPass::run(Module &M,
if (nullptr == ReplaceFunc)
ReplaceFunc = getReplaceFunc(M, Entry.second, Use, Args);
auto *NewI = CallInst::Create(ReplaceFunc->getFunctionType(), ReplaceFunc,
Args, "", I);
Args, "", I->getIterator());
// If the parent function has debug info, we need to make sure that the
// CallInstructions in it have debug info, otherwise we end up with
// invalid IR after inlining.
Expand Down
Loading