[PATCH] D110271: [llvm-profgen] Fix an out-of-range error during unwinding

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 10:51:24 PDT 2021


wenlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/PerfReader.cpp:65
     uint64_t LeafAddr = State.CurrentLeafFrame->Address;
-    while (IP.Address >= Target) {
+    while (IP.Address >= Target && IP.Index != 0) {
       uint64_t PrevIP = IP.Address;
----------------
wenlei wrote:
> Why do we run into such cases? Is the profile corrupted? If that's the case, it may make sense to emit a warning about corrupted profile.
> 
> As for the check itself, how about fold it into advance/backward, and let them return a boolean for caller to check? Index is implementation details of InstructionPoint and would be good to avoid using it from outside.  
Actually Index==0 is still valid, the problem is we cannot "backward" from index 0. However we still want to "recordRangeCount" if this index 0 is the end of the linear range. But the fix would skip "recordRangeCount" in end of range has index 0, which looks incorrect. Or am I missing something? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110271



More information about the llvm-commits mailing list