[PATCH] D92896: [CSSPGO][llvm-profgen] Virtual unwinding with pseudo probe

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 17:55:16 PST 2020


wlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:112
+    auto EndT = std::prev(CallStack.rend());
+    for (; Iter != EndT; Iter++) {
+      uint64_t Address = *Iter;
----------------
wlei wrote:
> hoy wrote:
> > `for (auto Address : reverse(CallStack))   ...` 
> seems it's a bug, it should not be reversed, let me fix.
it's not a bug, the call stack is leaf to root order, should be reversed.
But here note that I need to skip the leaf frame. so the code will be like:
```
bool IsLeaf = true;
for (auto Address : reverse(CallStack)) {
    if (IsLeaf) {
        IsLeaf = false;
        continue;
   }
   ...
}
```

Btw, I didn't use reverse like this way before, so it will act as a iterator wrapper, won't reverse the vector's inside elements, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92896



More information about the llvm-commits mailing list