[llvm] [llvm-profgen] Fix bogus trace check (PR #225569)

Kunal Pathak via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 19:56:35 PDT 2026


================
@@ -911,6 +919,19 @@ void HybridPerfReader::parseSample(TraceStream &TraceIt, uint64_t Count) {
       if (IgnoreStackSamples) {
         Sample->CallStack.clear();
       } else {
+        NumTotalHybridSample++;
+        // Drop samples whose callchain and LBR disagree before the
+        // canonicalization below hides the disagreement.
+        uint64_t StackLeaf = Sample->CallStack.front();
+        uint64_t LBRLeaf = Sample->LBRStack[0].Target;
+        if (!isValidTrace(Binary, StackLeaf, LBRLeaf)) {
+          NumBogusTrace++;
+          if (ShowDetailedWarning)
+            WithColor::warning()
----------------
kunalspathak wrote:

Can we add some test coverage?

https://github.com/llvm/llvm-project/pull/225569


More information about the llvm-commits mailing list