[llvm] [BOLT][DWARF] Refactor address ranges processing (PR #71225)
Alexander Yermolovich via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 16:36:09 PDT 2023
================
@@ -4251,92 +4251,88 @@ uint64_t BinaryFunction::translateInputToOutputAddress(uint64_t Address) const {
BB->getOutputAddressRange().second);
}
-DebugAddressRangesVector BinaryFunction::translateInputToOutputRanges(
- const DWARFAddressRangesVector &InputRanges) const {
- DebugAddressRangesVector OutputRanges;
+DebugAddressRangesVector
+BinaryFunction::translateInputToOutputRange(DebugAddressRange InRange) const {
+ DebugAddressRangesVector OutRanges;
+ // The function was removed from the output. Return an empty range.
if (isFolded())
- return OutputRanges;
+ return OutRanges;
- // If the function hasn't changed return the same ranges.
+ // If the function hasn't changed return the same range.
if (!isEmitted()) {
- OutputRanges.resize(InputRanges.size());
- llvm::transform(InputRanges, OutputRanges.begin(),
- [](const DWARFAddressRange &Range) {
- return DebugAddressRange(Range.LowPC, Range.HighPC);
- });
- return OutputRanges;
+ OutRanges.emplace_back(InRange);
+ return OutRanges;
+ }
+
+ if (!containsAddress(InRange.LowPC))
+ return OutRanges;
+
+ // Special case of an empty range [X, X). Some tools expect X to be updated.
+ if (InRange.LowPC == InRange.HighPC) {
----------------
ayermolo wrote:
what happens here when lowPC is tombstoned to 0?
https://github.com/llvm/llvm-project/pull/71225
More information about the llvm-commits
mailing list