[PATCH] D115550: [CSSPGO][llvm-profgen] Fix external address issues of perf reader (return to external addr part)

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 12 23:33:51 PST 2021


hoy added inline comments.


================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:196
   if (!Cur->isDummyRoot()) {
-    if (!Stack.pushFrame(Cur)) {
+    // Truncate the context for artificial frame sine we won't do inlining for
+    // external addresses.
----------------
nit: ... since this isn't a real call context the compiler will see


================
Comment at: llvm/tools/llvm-profgen/PerfReader.h:317
+      CurrentLeafFrame = CurrentLeafFrame->Parent;
+    CurrentLeafFrame = CurrentLeafFrame->Parent;
+  }
----------------
nit: switch the two statements for readability? A comment would also be helpful.


================
Comment at: llvm/tools/llvm-profgen/PerfReader.h:433
   bool pushFrame(UnwindState::ProfiledFrame *Cur) {
+    assert(!Cur->IsArtificialFrame() && "Push an artificial frame.");
     Stack.push_back(Cur->Address);
----------------
wenlei wrote:
> nit: if we don't expect pushing artificial frame, the message can be explicit, something like "Artificial frame not expected for context stack."
Or we just return false for artificial frames so that it doesn't need to be handled on the caller side?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115550



More information about the llvm-commits mailing list