Skip to content

Commit 3c1ff53

Browse files
authored
Move away from some more insert-before constructors; NFC (#2514)
In preparation for LLVM's deprecation of Instruction constructors and Create methods that accept `Instruction` pointers, upgrade call sites to pass an iterator instead of an `Instruction` pointer.
1 parent a3d840e commit 3c1ff53

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/SPIRV/SPIRVLowerBool.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void SPIRVLowerBoolBase::visitTruncInst(TruncInst &I) {
7272
I.getIterator());
7373
And->setDebugLoc(I.getDebugLoc());
7474
auto *Zero = getScalarOrVectorConstantInt(Op->getType(), 0, false);
75-
auto *Cmp = new ICmpInst(&I, CmpInst::ICMP_NE, And, Zero);
75+
auto *Cmp = new ICmpInst(I.getIterator(), CmpInst::ICMP_NE, And, Zero);
7676
replace(&I, Cmp);
7777
}
7878
}

lib/SPIRV/SPIRVToOCL20.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void SPIRVToOCL20Base::visitCallSPIRVAtomicCmpExchg(CallInst *CI) {
207207
// instructions returns this new/original value as a resulting value.
208208
AllocaInst *PExpected = new AllocaInst(
209209
MemTy, 0, "expected",
210-
&*CI->getParent()->getParent()->getEntryBlock().getFirstInsertionPt());
210+
CI->getParent()->getParent()->getEntryBlock().getFirstInsertionPt());
211211
PExpected->setAlignment(Align(MemTy->getScalarSizeInBits() / 8));
212212

213213
// Tail call implies that the callee doesn't access alloca from the caller.

lib/SPIRV/SPIRVUtil.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ bool postProcessBuiltinWithArrayArguments(Function *F,
22722272
auto *T = I->getType();
22732273
if (!T->isArrayTy())
22742274
continue;
2275-
auto *Alloca = new AllocaInst(T, 0, "", &(*FBegin));
2275+
auto *Alloca = new AllocaInst(T, 0, "", FBegin);
22762276
new StoreInst(I, Alloca, false, CI->getIterator());
22772277
auto *Zero =
22782278
ConstantInt::getNullValue(Type::getInt32Ty(T->getContext()));

0 commit comments

Comments
 (0)