[llvm] d7daf1d - [llvm][llvm-profgen] Fix printing bogus trace info on 32-bit (#226965)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 00:45:33 PDT 2026
Author: David Spickett
Date: 2026-09-29T08:45:26+01:00
New Revision: d7daf1d24be8231f7f422ef2bca1003d4b77ec11
URL: https://github.com/llvm/llvm-project/commit/d7daf1d24be8231f7f422ef2bca1003d4b77ec11
DIFF: https://github.com/llvm/llvm-project/commit/d7daf1d24be8231f7f422ef2bca1003d4b77ec11.diff
LOG: [llvm][llvm-profgen] Fix printing bogus trace info on 32-bit (#226965)
And as a result, fix
llvm/test/tools/llvm-profgen/AArch64/cs-bogus-trace.test when run on Arm
32-bit:
https://lab.llvm.org/buildbot/#/builders/122/builds/59
Fixes #225569 / 28fec94991905d8dd8a08658e9590e13b7fe1af5.
`x` is for an unsigned integer but the argument given for it is a
uint64_t. This worked on 64-bit (maybe it's passed in a register), but
not on 32-bit where we got strange values printed.
Use format_hex instead, so we don't have to choose a format code.
Added:
Modified:
llvm/tools/llvm-profgen/PerfReader.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-profgen/PerfReader.cpp b/llvm/tools/llvm-profgen/PerfReader.cpp
index 4c266b4f3d9aa..521c0ce0e3c25 100644
--- a/llvm/tools/llvm-profgen/PerfReader.cpp
+++ b/llvm/tools/llvm-profgen/PerfReader.cpp
@@ -932,8 +932,8 @@ void HybridPerfReader::parseSample(TraceStream &TraceIt, uint64_t Count) {
NumBogusTrace++;
if (ShowDetailedWarning)
WithColor::warning()
- << "Bogus trace: stack tip = " << format("%#010x", StackLeaf)
- << ", LBR tip = " << format("%#010x\n", LBRLeaf);
+ << "Bogus trace: stack tip = " << format_hex(StackLeaf, 10)
+ << ", LBR tip = " << format_hex(LBRLeaf, 10) << "\n";
return;
}
// Canonicalize stack leaf to avoid 'random' IP from leaf frame skew LBR
More information about the llvm-commits
mailing list