[PATCH] D145709: [SPIR-V] Fix llvm deprecated warnings
Michal Paszkowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 9 11:00:56 PST 2023
mpaszkowski created this revision.
mpaszkowski added reviewers: iliya-diyachkov, zuban32, konrad.trifunovic.
Herald added subscribers: ThomasRaoux, hiraditya.
Herald added a project: All.
mpaszkowski requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Fixes warnings related to getAllOnesValue and isNullValue being deprecated.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145709
Files:
llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
llvm/lib/Target/SPIRV/SPIRVInstrInfo.td
llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
Index: llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
===================================================================
--- llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
+++ llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
@@ -1080,8 +1080,8 @@
const SPIRVType *ResType,
MachineInstr &I) const {
unsigned BitWidth = GR.getScalarOrVectorBitWidth(ResType);
- APInt One = AllOnes ? APInt::getAllOnesValue(BitWidth)
- : APInt::getOneBitSet(BitWidth, 0);
+ APInt One =
+ AllOnes ? APInt::getAllOnes(BitWidth) : APInt::getOneBitSet(BitWidth, 0);
if (ResType->getOpcode() == SPIRV::OpTypeVector)
return GR.getOrCreateConsIntVector(One.getZExtValue(), I, ResType, TII);
return GR.getOrCreateConstInt(One.getZExtValue(), I, ResType, TII);
@@ -1180,10 +1180,10 @@
const APInt &Imm,
MachineInstr &I) const {
unsigned TyOpcode = ResType->getOpcode();
- assert(TyOpcode != SPIRV::OpTypePointer || Imm.isNullValue());
+ assert(TyOpcode != SPIRV::OpTypePointer || Imm.isZero());
MachineBasicBlock &BB = *I.getParent();
if ((TyOpcode == SPIRV::OpTypePointer || TyOpcode == SPIRV::OpTypeEvent) &&
- Imm.isNullValue())
+ Imm.isZero())
return BuildMI(BB, I, I.getDebugLoc(), TII.get(SPIRV::OpConstantNull))
.addDef(ResVReg)
.addUse(GR.getSPIRVTypeID(ResType))
Index: llvm/lib/Target/SPIRV/SPIRVInstrInfo.td
===================================================================
--- llvm/lib/Target/SPIRV/SPIRVInstrInfo.td
+++ llvm/lib/Target/SPIRV/SPIRVInstrInfo.td
@@ -213,7 +213,7 @@
def PseudoConstF: FPImmLeaf<f32, [{ return true; }], fimm_to_i32>;
def ConstPseudoTrue: IntImmLeaf<i32, [{ return Imm.getBitWidth() == 1 && Imm.getZExtValue() == 1; }]>;
def ConstPseudoFalse: IntImmLeaf<i32, [{ return Imm.getBitWidth() == 1 && Imm.getZExtValue() == 0; }]>;
-def ConstPseudoNull: IntImmLeaf<i64, [{ return Imm.isNullValue(); }]>;
+def ConstPseudoNull: IntImmLeaf<i64, [{ return Imm.isZero(); }]>;
multiclass IntFPImm<bits<16> opCode, string name> {
def I: Op<opCode, (outs ID:$dst), (ins TYPE:$type, ID:$src, variable_ops),
Index: llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
===================================================================
--- llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -305,7 +305,7 @@
if (ReturnType->getOpcode() == SPIRV::OpTypeVector) {
unsigned Bits = GR->getScalarOrVectorBitWidth(ReturnType);
- uint64_t AllOnes = APInt::getAllOnesValue(Bits).getZExtValue();
+ uint64_t AllOnes = APInt::getAllOnes(Bits).getZExtValue();
TrueConst = GR->getOrCreateConsIntVector(AllOnes, MIRBuilder, ReturnType);
FalseConst = GR->getOrCreateConsIntVector(0, MIRBuilder, ReturnType);
} else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145709.503854.patch
Type: text/x-patch
Size: 2945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230309/11f16ced/attachment.bin>
More information about the llvm-commits
mailing list