[llvm] 981a38b - [AArch64AsmParser] Fix type-limits warning for VectorIndex.
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 8 07:36:26 PST 2021
Author: Sander de Smalen
Date: 2021-02-08T15:35:30Z
New Revision: 981a38baf43929c52829aa0e635710645a31b41d
URL: https://github.com/llvm/llvm-project/commit/981a38baf43929c52829aa0e635710645a31b41d
DIFF: https://github.com/llvm/llvm-project/commit/981a38baf43929c52829aa0e635710645a31b41d.diff
LOG: [AArch64AsmParser] Fix type-limits warning for VectorIndex.
Making VectorIndex an `int` instead of `unsigned`, silences the warning:
comparison of unsigned expression in ‘>= 0’ is always true
in:
template <int Min, int Max>
DiagnosticPredicate isVectorIndex() const {
...
if (VectorIndex.Val >= Min && VectorIndex.Val <= Max)
return DiagnosticPredicateTy::Match;
...
}
when Min is 0.
Added:
Modified:
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 96c50ff3f8d0..037e24b1b486 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -379,7 +379,7 @@ class AArch64Operand : public MCParsedAsmOperand {
};
struct VectorIndexOp {
- unsigned Val;
+ int Val;
};
struct ImmOp {
@@ -599,7 +599,7 @@ class AArch64Operand : public MCParsedAsmOperand {
return VectorList.Count;
}
- unsigned getVectorIndex() const {
+ int getVectorIndex() const {
assert(Kind == k_VectorIndex && "Invalid access!");
return VectorIndex.Val;
}
@@ -1931,7 +1931,7 @@ class AArch64Operand : public MCParsedAsmOperand {
}
static std::unique_ptr<AArch64Operand>
- CreateVectorIndex(unsigned Idx, SMLoc S, SMLoc E, MCContext &Ctx) {
+ CreateVectorIndex(int Idx, SMLoc S, SMLoc E, MCContext &Ctx) {
auto Op = std::make_unique<AArch64Operand>(k_VectorIndex, Ctx);
Op->VectorIndex.Val = Idx;
Op->StartLoc = S;
More information about the llvm-commits
mailing list