[llvm] [BOLT][DWARF][NFC] Remove DWO ranges base (PR #99280)
Sayhaan Siddiqui via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 00:11:40 PDT 2024
https://github.com/sayhaan updated https://github.com/llvm/llvm-project/pull/99280
>From c77b8baca46ec759f95c15a5207ad112843012cd Mon Sep 17 00:00:00 2001
From: Sayhaan Siddiqui <sayhaan at meta.com>
Date: Wed, 17 Jul 2024 00:03:09 -0700
Subject: [PATCH] Remove dead code for DWORangesBase
---
bolt/include/bolt/Rewrite/DWARFRewriter.h | 9 ---
bolt/lib/Rewrite/DWARFRewriter.cpp | 68 +++++++++++------------
2 files changed, 32 insertions(+), 45 deletions(-)
diff --git a/bolt/include/bolt/Rewrite/DWARFRewriter.h b/bolt/include/bolt/Rewrite/DWARFRewriter.h
index abd18b56113b6..b798c5b76fc28 100644
--- a/bolt/include/bolt/Rewrite/DWARFRewriter.h
+++ b/bolt/include/bolt/Rewrite/DWARFRewriter.h
@@ -95,9 +95,6 @@ class DWARFRewriter {
std::mutex LocListDebugInfoPatchesMutex;
- /// Dwo id specific its RangesBase.
- std::unordered_map<uint64_t, uint64_t> DwoRangesBase;
-
std::unordered_map<DWARFUnit *, uint64_t> LineTablePatchMap;
std::unordered_map<const DWARFUnit *, uint64_t> TypeUnitRelocMap;
@@ -191,12 +188,6 @@ class DWARFRewriter {
/// Update stmt_list for CUs based on the new .debug_line \p Layout.
void updateLineTableOffsets(const MCAssembler &Asm);
- uint64_t getDwoRangesBase(uint64_t DWOId) { return DwoRangesBase[DWOId]; }
-
- void setDwoRangesBase(uint64_t DWOId, uint64_t RangesBase) {
- DwoRangesBase[DWOId] = RangesBase;
- }
-
using OverriddenSectionsMap = std::unordered_map<DWARFSectionKind, StringRef>;
/// Output .dwo files.
void writeDWOFiles(DWARFUnit &, const OverriddenSectionsMap &,
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 042c39a574561..5fbfe3cb147c6 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -685,42 +685,38 @@ void DWARFRewriter::updateDebugInfo() {
std::optional<uint64_t> DWOId = Unit->getDWOId();
if (DWOId)
SplitCU = BC.getDWOCU(*DWOId);
- DebugLocWriter *DebugLocWriter = createRangeLocListAddressWriters(*Unit);
- DebugRangesSectionWriter *RangesSectionWriter =
- Unit->getVersion() >= 5 ? RangeListsSectionWriter.get()
- : LegacyRangesSectionWriter.get();
- DebugAddrWriter *AddressWriter =
- AddressWritersByCU[Unit->getOffset()].get();
- // Skipping CUs that failed to load.
- if (SplitCU) {
- DIEBuilder DWODIEBuilder(BC, &(*SplitCU)->getContext(), DebugNamesTable,
- Unit);
- DWODIEBuilder.buildDWOUnit(**SplitCU);
- std::string DWOName = "";
- std::optional<std::string> DwarfOutputPath =
- opts::DwarfOutputPath.empty()
- ? std::nullopt
- : std::optional<std::string>(opts::DwarfOutputPath.c_str());
- {
- std::lock_guard<std::mutex> Lock(AccessMutex);
- DWOName = DIEBlder->updateDWONameCompDir(
- *StrOffstsWriter, *StrWriter, *Unit, DwarfOutputPath, std::nullopt);
- }
- DebugStrOffsetsWriter DWOStrOffstsWriter(BC);
- DebugStrWriter DWOStrWriter((*SplitCU)->getContext(), true);
- DWODIEBuilder.updateDWONameCompDirForTypes(DWOStrOffstsWriter,
- DWOStrWriter, **SplitCU,
- DwarfOutputPath, DWOName);
- DebugLoclistWriter DebugLocDWoWriter(*Unit, Unit->getVersion(), true,
- *AddressWriter);
- DebugRangesSectionWriter *TempRangesSectionWriter = RangesSectionWriter;
- if (Unit->getVersion() >= 5) {
- TempRangesSectionWriter = RangeListsWritersByCU[*DWOId].get();
- } else {
- TempRangesSectionWriter = LegacyRangesWritersByCU[*DWOId].get();
- RangesBase = RangesSectionWriter->getSectionOffset();
- setDwoRangesBase(*DWOId, *RangesBase);
- }
+ if (!SplitCU)
+ return;
+ DebugAddrWriter &AddressWriter =
+ *AddressWritersByCU[Unit->getOffset()].get();
+ DIEBuilder DWODIEBuilder(BC, &(*SplitCU)->getContext(), DebugNamesTable,
+ Unit);
+ DWODIEBuilder.buildDWOUnit(**SplitCU);
+ std::string DWOName = "";
+ std::optional<std::string> DwarfOutputPath =
+ opts::DwarfOutputPath.empty()
+ ? std::nullopt
+ : std::optional<std::string>(opts::DwarfOutputPath.c_str());
+ {
+ std::lock_guard<std::mutex> Lock(AccessMutex);
+ DWOName = DIEBlder->updateDWONameCompDir(
+ *StrOffstsWriter, *StrWriter, *Unit, DwarfOutputPath, std::nullopt);
+ }
+ DebugStrOffsetsWriter DWOStrOffstsWriter(BC);
+ DebugStrWriter DWOStrWriter((*SplitCU)->getContext(), true);
+ DWODIEBuilder.updateDWONameCompDirForTypes(
+ DWOStrOffstsWriter, DWOStrWriter, **SplitCU, DwarfOutputPath, DWOName);
+ DebugLoclistWriter DebugLocDWoWriter(*Unit, Unit->getVersion(), true,
+ AddressWriter);
+ DebugRangesSectionWriter *TempRangesSectionWriter;
+ if (Unit->getVersion() >= 5) {
+ TempRangesSectionWriter = RangeListsWritersByCU[*DWOId].get();
+ } else {
+ TempRangesSectionWriter = LegacyRangesWritersByCU[*DWOId].get();
+ RangesBase = Unit->getVersion() >= 5
+ ? RangeListsSectionWriter.get()->getSectionOffset()
+ : LegacyRangesSectionWriter.get()->getSectionOffset();
+ }
updateUnitDebugInfo(*(*SplitCU), DWODIEBuilder, DebugLocDWoWriter,
*TempRangesSectionWriter, *AddressWriter);
More information about the llvm-commits
mailing list