[PATCH] D112282: [llvm-profgen] Switch to DWARF-based symbol and ranges

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 21:26:05 PDT 2021


wlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:499
     uint64_t EndOffset = I.second;
     Binary->computeInlinedContextSizeForRange(StartOffset, EndOffset);
   }
----------------
dblaikie wrote:
> wlei wrote:
> > hoy wrote:
> > > From the way ranges of a dwarf symbol are populated, `EndOffset` should not be a part of a range (exclusive). But `computeInlinedContextSizeForRange` expects the opposite.
> > Good point, I just changed EndOffset inclusive range.
> > ```
> > uint64_t EndOffset = Range.HighPC - getPreferredBaseAddress() - 1;
> > ```
> (it might be best to use an exclusive end, like DWARF does - for consistency and to enable representing zero-length ranges (which do come up at the moment in LLVM's codegen - zero length functions can produce situations where `lowpc == highpc`, so if you use - 1 you might end up with a weird situation where highpc < lowpc which could be problematic)
I see, `-1` is indeed a weird case for this. Thanks for the suggestion!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112282



More information about the llvm-commits mailing list