[llvm] [llvm-profdata] Emit error when counter value is greater than 2^56. (PR #69513)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 19 13:47:08 PDT 2023
================
@@ -676,8 +677,12 @@ Error RawInstrProfReader<IntPtrT>::readRawCounts(
// A value of zero signifies the block is covered.
Record.Counts.push_back(*Ptr == 0 ? 1 : 0);
} else {
- const auto *CounterValue = reinterpret_cast<const uint64_t *>(Ptr);
- Record.Counts.push_back(swap(*CounterValue));
+ uint64_t CounterValue = swap(*reinterpret_cast<const uint64_t *>(Ptr));
+ if (CounterValue > MaxCounterValue)
+ WithColor::warning() << "counter value " + Twine(CounterValue) +
----------------
aeubanks wrote:
I'd say something about the value being large, like "excessively large counter value ### suggests corrupted profile data"
https://github.com/llvm/llvm-project/pull/69513
More information about the llvm-commits
mailing list