[PATCH] D115538: [CSSPGO][llvm-profgen] Fix external address issues of perf reader (leading external LBR part)

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 22:15:52 PST 2021


hoy added inline comments.


================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:624
+        NumTopExternalFrame++;
+        CallStack.emplace_back(UnwindState::ProfiledFrame::ExternalAddr);
+      }
----------------
wlei wrote:
> hoy wrote:
> > wlei wrote:
> > > wenlei wrote:
> > > > If only leaf frames are external, can we keep the remaining frames for unwinding?
> > > Sounds good, tried to keep the remaining internal call stack for unwinding.
> > Maybe we can keep the whole call stack by replacing consecutive external frames with an artificial frame introduced in the other patch. This should be synchronized with the LBR parser where we replace consecutive external LBRs with an artificial branch. 
> Good point. Changed to both use `external branch`, update in the next patch.
Thanks. Just to be clear, we will no longer need to break, instead, we'll continue whenever the top of stack is also an ExternalAddr. This way we could handle the following case


```
Ext
Ext
foo
Ext
Ext
bar
main
Ext/Ext /Ext/Ext foo/Ext foo/foo Ext/foo Ext/Ext bar/Ext bar/bar bar/bar ...
```

Though this should be rare, for completeness does it sounds reasonable? 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115538



More information about the llvm-commits mailing list