[PATCH] D111577: [llvm-profgen] Ignore stack samples before aggregation

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 11 15:09:16 PDT 2021


wlei updated this revision to Diff 378809.
wlei added a comment.

moved into `if` branch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111577/new/

https://reviews.llvm.org/D111577

Files:
  llvm/tools/llvm-profgen/PerfReader.cpp


Index: llvm/tools/llvm-profgen/PerfReader.cpp
===================================================================
--- llvm/tools/llvm-profgen/PerfReader.cpp
+++ llvm/tools/llvm-profgen/PerfReader.cpp
@@ -647,9 +647,13 @@
   if (!TraceIt.isAtEoF() && TraceIt.getCurrentLine().startswith(" 0x")) {
     // Parsing LBR stack and populate into PerfSample.LBRStack
     if (extractLBRStack(TraceIt, Sample->LBRStack)) {
-      // Canonicalize stack leaf to avoid 'random' IP from leaf frame skew LBR
-      // ranges
-      Sample->CallStack.front() = Sample->LBRStack[0].Target;
+      if (IgnoreStackSamples) {
+        Sample->CallStack.clear();
+      } else {
+        // Canonicalize stack leaf to avoid 'random' IP from leaf frame skew LBR
+        // ranges
+        Sample->CallStack.front() = Sample->LBRStack[0].Target;
+      }
       // Record samples by aggregation
       AggregatedSamples[Hashable<PerfSample>(Sample)] += Count;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111577.378809.patch
Type: text/x-patch
Size: 947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211011/3359e25d/attachment.bin>


More information about the llvm-commits mailing list