Skip to content

Commit 9219ede

Browse files
[SYCL][NFC] Stop using deprecated InsertionPoint constructor (#16658)
See llvm/llvm-project#102608
1 parent a73541c commit 9219ede

File tree

8 files changed

+21
-22
lines changed

8 files changed

+21
-22
lines changed

llvm/lib/SYCLLowerIR/ESIMD/ESIMDOptimizeVecArgCallConv.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,8 @@ optimizeFunction(Function *OldF,
354354
// preserve data flow equality to the original.
355355
unsigned OldArgNo = PI.getFormalParam().getArgNo();
356356
unsigned NewArgNo = oldArgNo2NewArgNo(OldArgNo, SretInd);
357-
Instruction *At = nullptr;
358357
Value *Val = NewF->getArg(NewArgNo);
359-
StoreInst *St = new StoreInst(Val, Alloca, false, Al, At);
358+
StoreInst *St = new StoreInst(Val, Alloca, false, Al);
360359
NewInsts.push_back(St);
361360
}
362361
}

llvm/lib/SYCLLowerIR/ESIMD/LowerESIMD.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ static Instruction *addCastInstIfNeeded(Instruction *OldI, Instruction *NewI,
12391239
if (OITy != NITy) {
12401240
auto CastOpcode = CastInst::getCastOpcode(NewI, false, OITy, false);
12411241
NewI = CastInst::Create(CastOpcode, NewI, OITy,
1242-
NewI->getName() + ".cast.ty", OldI);
1242+
NewI->getName() + ".cast.ty", OldI->getIterator());
12431243
NewI->setDebugLoc(OldI->getDebugLoc());
12441244
}
12451245
return NewI;
@@ -1565,7 +1565,7 @@ static void translateESIMDIntrinsicCall(CallInst &CI) {
15651565
CallInst *NewCI = IntrinsicInst::Create(
15661566
NewFDecl, GenXArgs,
15671567
NewFDecl->getReturnType()->isVoidTy() ? "" : CI.getName() + ".esimd",
1568-
&CI);
1568+
CI.getIterator());
15691569
NewCI->setDebugLoc(CI.getDebugLoc());
15701570
if (DoesFunctionReturnStructure) {
15711571
IRBuilder<> Builder(&CI);

llvm/lib/SYCLLowerIR/GlobalOffset.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void GlobalOffsetPass::addImplicitParameterToCallers(
250250
/* Func= */ CalleeWithImplicitParam,
251251
/* Args= */ ImplicitOffsets,
252252
/* NameStr= */ Twine(),
253-
/* InsertBefore= */ CallToOld);
253+
/* InsertBefore= */ CallToOld->getIterator());
254254
NewCallInst->setTailCallKind(CallToOld->getTailCallKind());
255255
NewCallInst->copyMetadata(*CallToOld);
256256
CallToOld->replaceAllUsesWith(NewCallInst);

llvm/lib/SYCLLowerIR/LocalAccessorToSharedMemory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Function *LocalAccessorToSharedMemoryPass::processKernel(Module &M,
177177
ConstantInt::get(Type::getInt32Ty(M.getContext()), 0, false),
178178
NFA,
179179
},
180-
/* NameStr= */ Twine{NFA->getName()}, InsertBefore);
180+
/* NameStr= */ Twine{NFA->getName()}, InsertBefore->getIterator());
181181
// Then create a bitcast to make sure the new pointer is the same type
182182
// as the old one. This will only ever be a `i8 addrspace(3)*` to `i32
183183
// addrspace(3)*` type of cast.

llvm/lib/SYCLLowerIR/LowerInvokeSimd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ bool processInvokeSimdCall(CallInst *InvokeSimd,
461461
NewInvokeSimdArgs.push_back(NewHelper);
462462
auto ThirdArg = std::next(InvokeSimd->arg_begin(), 2);
463463
NewInvokeSimdArgs.append(ThirdArg, InvokeSimd->arg_end());
464-
CallInst *NewInvokeSimd =
465-
CallInst::Create(NewInvokeSimdF, NewInvokeSimdArgs, "", InvokeSimd);
464+
CallInst *NewInvokeSimd = CallInst::Create(
465+
NewInvokeSimdF, NewInvokeSimdArgs, "", InvokeSimd->getIterator());
466466
// - transfer flags, attributes (with shrinking), calling convention:
467467
NewInvokeSimd->copyIRFlags(InvokeSimd);
468468
NewInvokeSimd->setCallingConv(InvokeSimd->getCallingConv());

llvm/lib/SYCLLowerIR/LowerWGScope.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ Value *spirv::genPseudoLocalID(Instruction &Before, const Triple &TT) {
981981
Align Alignment = M.getDataLayout().getPreferredAlign(G);
982982
G->setAlignment(MaybeAlign(Alignment));
983983
}
984-
Value *Res = new LoadInst(G->getValueType(), G, "", &Before);
984+
Value *Res = new LoadInst(G->getValueType(), G, "", Before.getIterator());
985985
return Res;
986986
}
987987
}

llvm/lib/SYCLLowerIR/SpecConstants.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,15 @@ Instruction *emitCall(Type *RetTy, StringRef BaseFunctionName,
514514
auto *NewFT = FunctionType::get(NewRetTy, ArgTys, false /*isVarArg*/);
515515
auto NewFC = M->getOrInsertFunction(FunctionName, NewFT);
516516

517-
auto *Call =
518-
CallInst::Create(NewFT, NewFC.getCallee(), Args, "", InsertBefore);
517+
auto *Call = CallInst::Create(NewFT, NewFC.getCallee(), Args, "",
518+
InsertBefore->getIterator());
519519
if (IsSPIROrSPIRV) {
520520
cast<Function>(NewFC.getCallee())
521521
->setCallingConv(CallingConv::SPIR_FUNC);
522522
Call->setCallingConv(CallingConv::SPIR_FUNC);
523523
}
524524
return CastInst::CreateTruncOrBitCast(Call, RetTy, "tobool",
525-
InsertBefore);
525+
InsertBefore->getIterator());
526526
}
527527
}
528528

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

716716
Instruction *BitCast = nullptr;
717717
if (SCType->isIntegerTy(1)) // No bitcast to i1 before load
718718
BitCast = GEP;
719719
else
720720
BitCast =
721721
new BitCastInst(GEP, PointerType::get(SCType, GEP->getAddressSpace()),
722-
"bc", InsertBefore);
722+
"bc", InsertBefore->getIterator());
723723

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

731731
return Load;
732732
}
@@ -993,8 +993,8 @@ PreservedAnalyses SpecConstantsPass::run(Module &M,
993993
if (SCTy->isIntegerTy(1)) {
994994
assert(DefaultValue->getType()->isIntegerTy(8) &&
995995
"For bool spec constant default value is expected to be i8");
996-
Replacement =
997-
new TruncInst(DefaultValue, Type::getInt1Ty(Ctx), "bool", CI);
996+
Replacement = new TruncInst(DefaultValue, Type::getInt1Ty(Ctx),
997+
"bool", CI->getIterator());
998998
} else
999999
Replacement = DefaultValue;
10001000
}
@@ -1021,9 +1021,9 @@ PreservedAnalyses SpecConstantsPass::run(Module &M,
10211021
Value *ArraySize =
10221022
Mode == HandlingMode::emulation ? DefaultValue : Replacement;
10231023
assert(ArraySize->getType()->isIntegerTy() && "Expecting integer type");
1024-
Replacement =
1025-
new AllocaInst(Intr->getAllocatedType(), Intr->getAddressSpace(),
1026-
ArraySize, Intr->getAlign(), "alloca", CI);
1024+
Replacement = new AllocaInst(
1025+
Intr->getAllocatedType(), Intr->getAddressSpace(), ArraySize,
1026+
Intr->getAlign(), "alloca", CI->getIterator());
10271027
}
10281028

10291029
if (HasSretParameter)

llvm/lib/SYCLNativeCPUUtils/PrepareSYCLNativeCPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ PreservedAnalyses PrepareSYCLNativeCPUPass::run(Module &M,
426426
if (nullptr == ReplaceFunc)
427427
ReplaceFunc = getReplaceFunc(M, Entry.second, Use, Args);
428428
auto *NewI = CallInst::Create(ReplaceFunc->getFunctionType(), ReplaceFunc,
429-
Args, "", I);
429+
Args, "", I->getIterator());
430430
// If the parent function has debug info, we need to make sure that the
431431
// CallInstructions in it have debug info, otherwise we end up with
432432
// invalid IR after inlining.

0 commit comments

Comments
 (0)