From b79e46318f9965d34bb9e978d2a69f1f7f260a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 20 Sep 2024 15:53:36 +0200 Subject: [PATCH 1/2] [SPIR-V] Fix minor build warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `warning: 'InsertPosition' is deprecated: Use BasicBlock::iterators for insertion instead [-Wdeprecated-declarations]` Calling `Instruction->getIterator()` removes the warning. Signed-off-by: Nathan Gauër --- llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp | 6 +++--- llvm/lib/Target/SPIRV/SPIRVStripConvergentIntrinsics.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp b/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp index 322e051a87db1..3b37ee9381693 100644 --- a/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp @@ -127,7 +127,7 @@ void SPIRVRegularizer::runLowerConstExpr(Function &F) { ReplList.push_back(Inst); Repl = InsertElementInst::Create( (Repl ? Repl : PoisonValue::get(Vec->getType())), V, - ConstantInt::get(Type::getInt32Ty(Ctx), Idx++), "", InsPoint); + ConstantInt::get(Type::getInt32Ty(Ctx), Idx++), "", InsPoint->getIterator()); } WorkList.splice(WorkList.begin(), ReplList); return Repl; @@ -235,10 +235,10 @@ void SPIRVRegularizer::visitCallScalToVec(CallInst *CI, StringRef MangledName, auto ConstInt = ConstantInt::get(IntegerType::get(CI->getContext(), 32), 0); PoisonValue *PVal = PoisonValue::get(Arg0Ty); Instruction *Inst = - InsertElementInst::Create(PVal, CI->getOperand(1), ConstInt, "", CI); + InsertElementInst::Create(PVal, CI->getOperand(1), ConstInt, "", CI->getIterator()); ElementCount VecElemCount = cast(Arg0Ty)->getElementCount(); Constant *ConstVec = ConstantVector::getSplat(VecElemCount, ConstInt); - Value *NewVec = new ShuffleVectorInst(Inst, PVal, ConstVec, "", CI); + Value *NewVec = new ShuffleVectorInst(Inst, PVal, ConstVec, "", CI->getIterator()); CI->setOperand(1, NewVec); CI->replaceUsesOfWith(OldF, NewF); CI->mutateFunctionType(NewF->getFunctionType()); diff --git a/llvm/lib/Target/SPIRV/SPIRVStripConvergentIntrinsics.cpp b/llvm/lib/Target/SPIRV/SPIRVStripConvergentIntrinsics.cpp index b632d78497767..c87048b93f80f 100644 --- a/llvm/lib/Target/SPIRV/SPIRVStripConvergentIntrinsics.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVStripConvergentIntrinsics.cpp @@ -62,7 +62,7 @@ class SPIRVStripConvergentIntrinsics : public FunctionPass { return; auto *NewCall = CallBase::removeOperandBundle( - CI, LLVMContext::OB_convergencectrl, CI); + CI, LLVMContext::OB_convergencectrl, CI->getIterator()); NewCall->copyMetadata(*CI); CI->replaceAllUsesWith(NewCall); ToRemove.insert(CI); From 37d36ecc13014771fcad3553c4869b7af768be62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathan=20Gau=C3=ABr?= Date: Fri, 20 Sep 2024 16:00:34 +0200 Subject: [PATCH 2/2] clang-format --- llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp b/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp index 3b37ee9381693..246eecd4ffcaa 100644 --- a/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVRegularizer.cpp @@ -127,7 +127,8 @@ void SPIRVRegularizer::runLowerConstExpr(Function &F) { ReplList.push_back(Inst); Repl = InsertElementInst::Create( (Repl ? Repl : PoisonValue::get(Vec->getType())), V, - ConstantInt::get(Type::getInt32Ty(Ctx), Idx++), "", InsPoint->getIterator()); + ConstantInt::get(Type::getInt32Ty(Ctx), Idx++), "", + InsPoint->getIterator()); } WorkList.splice(WorkList.begin(), ReplList); return Repl; @@ -234,11 +235,12 @@ void SPIRVRegularizer::visitCallScalToVec(CallInst *CI, StringRef MangledName, // %call = OpExtInst %v2uint %1 s_min %14 %11 auto ConstInt = ConstantInt::get(IntegerType::get(CI->getContext(), 32), 0); PoisonValue *PVal = PoisonValue::get(Arg0Ty); - Instruction *Inst = - InsertElementInst::Create(PVal, CI->getOperand(1), ConstInt, "", CI->getIterator()); + Instruction *Inst = InsertElementInst::Create( + PVal, CI->getOperand(1), ConstInt, "", CI->getIterator()); ElementCount VecElemCount = cast(Arg0Ty)->getElementCount(); Constant *ConstVec = ConstantVector::getSplat(VecElemCount, ConstInt); - Value *NewVec = new ShuffleVectorInst(Inst, PVal, ConstVec, "", CI->getIterator()); + Value *NewVec = + new ShuffleVectorInst(Inst, PVal, ConstVec, "", CI->getIterator()); CI->setOperand(1, NewVec); CI->replaceUsesOfWith(OldF, NewF); CI->mutateFunctionType(NewF->getFunctionType());