aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackMaps.cpp
diff options
context:
space:
mode:
authorHubert Tong <hubert.reinterpretcast@gmail.com>2020-10-20 20:50:38 -0400
committerHubert Tong <hubert.reinterpretcast@gmail.com>2020-10-20 20:52:10 -0400
commit134ffa8138c31444685013e10f592cd7c88d675b (patch)
tree429da080da0e6cc1d6d01ac2a19cc7ea0d3eebf4 /llvm/lib/CodeGen/StackMaps.cpp
parent15e772e8dc39f609115430f39078fbe58812fddb (diff)
downloadllvm-134ffa8138c31444685013e10f592cd7c88d675b.zip
llvm-134ffa8138c31444685013e10f592cd7c88d675b.tar.gz
llvm-134ffa8138c31444685013e10f592cd7c88d675b.tar.bz2
NFC: Fix -Wsign-compare warnings on 32-bit builds
Comparing 32-bit `ptrdiff_t` against 32-bit `unsigned` results in `-Wsign-compare` warnings for both GCC and Clang. The warning for the cases in question appear to identify an issue where the `ptrdiff_t` value would be mutated via conversion to an unsigned type. The warning is resolved by using the usual arithmetic conversions to safely preserve the value of the `unsigned` operand while trying to convert to a signed type. Host platforms where `unsigned` has the same width as `unsigned long long` will need to make a different change, but using an explicit cast has disadvantages that can be avoided for now. Reviewed By: dantrushin Differential Revision: https://reviews.llvm.org/D89612
Diffstat (limited to 'llvm/lib/CodeGen/StackMaps.cpp')
-rw-r--r--llvm/lib/CodeGen/StackMaps.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/StackMaps.cpp b/llvm/lib/CodeGen/StackMaps.cpp
index f7fb2e8..ee1a4a4 100644
--- a/llvm/lib/CodeGen/StackMaps.cpp
+++ b/llvm/lib/CodeGen/StackMaps.cpp
@@ -401,7 +401,7 @@ void StackMaps::parseStatepointOpers(const MachineInstr &MI,
SmallVector<unsigned, 8> GCPtrIndices;
unsigned GCPtrIdx = (unsigned)SO.getFirstGCPtrIdx();
assert((int)GCPtrIdx != -1);
- assert(MOI - MI.operands_begin() == GCPtrIdx);
+ assert(MOI - MI.operands_begin() == GCPtrIdx + 0LL);
while (NumGCPointers--) {
GCPtrIndices.push_back(GCPtrIdx);
GCPtrIdx = StackMaps::getNextMetaArgIdx(&MI, GCPtrIdx);