1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4

Differential Revision: https://reviews.llvm.org/D79337
This commit is contained in:
Alexandre Ganea 2020-05-04 18:14:25 -04:00
parent cf3ae8d32b
commit b53c3d0951

View File

@ -423,11 +423,11 @@ Error RawInstrProfReader<IntPtrT>::readRawCounts(
// Check bounds. Note that the counter pointer embedded in the data record // Check bounds. Note that the counter pointer embedded in the data record
// may itself be corrupt. // may itself be corrupt.
if (NumCounters > MaxNumCounters) if (MaxNumCounters < 0 || NumCounters > (uint32_t)MaxNumCounters)
return error(instrprof_error::malformed); return error(instrprof_error::malformed);
ptrdiff_t CounterOffset = getCounterOffset(CounterPtr); ptrdiff_t CounterOffset = getCounterOffset(CounterPtr);
if (CounterOffset < 0 || CounterOffset > MaxNumCounters || if (CounterOffset < 0 || CounterOffset > MaxNumCounters ||
(CounterOffset + NumCounters) > MaxNumCounters) ((uint32_t)CounterOffset + NumCounters) > (uint32_t)MaxNumCounters)
return error(instrprof_error::malformed); return error(instrprof_error::malformed);
auto RawCounts = makeArrayRef(getCounter(CounterOffset), NumCounters); auto RawCounts = makeArrayRef(getCounter(CounterOffset), NumCounters);