diff --git a/llvm/include/llvm/Support/BlockFrequency.h b/llvm/include/llvm/Support/BlockFrequency.h --- a/llvm/include/llvm/Support/BlockFrequency.h +++ b/llvm/include/llvm/Support/BlockFrequency.h @@ -27,7 +27,7 @@ BlockFrequency(uint64_t Freq = 0) : Frequency(Freq) { } /// Returns the maximum possible frequency, the saturation value. - static uint64_t getMaxFrequency() { return -1ULL; } + static uint64_t getMaxFrequency() { return UINT64_MAX; } /// Returns the frequency as a fixpoint number scaled by the entry /// frequency. diff --git a/llvm/include/llvm/Support/LEB128.h b/llvm/include/llvm/Support/LEB128.h --- a/llvm/include/llvm/Support/LEB128.h +++ b/llvm/include/llvm/Support/LEB128.h @@ -191,7 +191,7 @@ } while (Byte >= 128); // Sign extend negative numbers if needed. if (Shift < 64 && (Byte & 0x40)) - Value |= (-1ULL) << Shift; + Value |= UINT64_MAX << Shift; if (n) *n = (unsigned)(p - orig_p); return Value; diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -568,7 +568,7 @@ /* If we ran off the end it is exactly zero or one-half, otherwise a little more. */ - if (hexDigit == -1U) + if (hexDigit == UINT_MAX) return digitValue == 0 ? lfExactlyZero: lfExactlyHalf; else return digitValue == 0 ? lfLessThanHalf: lfMoreThanHalf; @@ -585,7 +585,7 @@ lsb = APInt::tcLSB(parts, partCount); - /* Note this is guaranteed true if bits == 0, or LSB == -1U. */ + /* Note this is guaranteed true if bits == 0, or LSB == UINT_MAX. */ if (bits <= lsb) return lfExactlyZero; if (bits == lsb + 1) @@ -2815,7 +2815,7 @@ } hex_value = hexDigitValue(*p); - if (hex_value == -1U) + if (hex_value == UINT_MAX) break; p++; diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -68,7 +68,7 @@ if (r < radix) return r; - return -1U; + return UINT_MAX; } @@ -2330,7 +2330,7 @@ } /// Returns the bit number of the least significant set bit of a number. If the -/// input number has no bits set -1U is returned. +/// input number has no bits set UINT_MAX is returned. unsigned APInt::tcLSB(const WordType *parts, unsigned n) { for (unsigned i = 0; i < n; i++) { if (parts[i] != 0) { @@ -2339,11 +2339,11 @@ } } - return -1U; + return UINT_MAX; } /// Returns the bit number of the most significant set bit of a number. -/// If the input number has no bits set -1U is returned. +/// If the input number has no bits set UINT_MAX is returned. unsigned APInt::tcMSB(const WordType *parts, unsigned n) { do { --n; @@ -2356,7 +2356,7 @@ } } while (n); - return -1U; + return UINT_MAX; } /// Copy the bit vector of width srcBITS from SRC, starting at bit srcLSB, to