[llvm] [BOLT][DWARF][NFC] Split processUnitDIE into two lambdas (PR #99225)

Sayhaan Siddiqui via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 16:51:43 PDT 2024


https://github.com/sayhaan updated https://github.com/llvm/llvm-project/pull/99225

>From e39928e43a69049010034cb81ff39c0700932205 Mon Sep 17 00:00:00 2001
From: Sayhaan Siddiqui <sayhaan at meta.com>
Date: Tue, 16 Jul 2024 11:25:48 -0700
Subject: [PATCH 1/4] Split processUnitDIE into two lambdas

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: https://phabricator.intern.facebook.com/D59822423
---
 bolt/lib/Rewrite/DWARFRewriter.cpp | 231 ++++++++++++++---------------
 1 file changed, 115 insertions(+), 116 deletions(-)

diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 4ba6344925856..0179ce7d853ad 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -632,44 +632,46 @@ void DWARFRewriter::updateDebugInfo() {
   std::mutex AccessMutex;
   // Needs to be invoked in the same order as CUs are processed.
   auto createRangeLocListAddressWriters =
-      [&](DWARFUnit &CU) -> DebugLocWriter * {
-    std::lock_guard<std::mutex> Lock(AccessMutex);
-    const uint16_t DwarfVersion = CU.getVersion();
-    if (DwarfVersion >= 5) {
-      auto AddrW = std::make_unique<DebugAddrWriterDwarf5>(
-          &BC, CU.getAddressByteSize(), CU.getAddrOffsetSectionBase());
-      RangeListsSectionWriter->setAddressWriter(AddrW.get());
-      LocListWritersByCU[CUIndex] =
-          std::make_unique<DebugLoclistWriter>(CU, DwarfVersion, false, *AddrW);
-
-      if (std::optional<uint64_t> DWOId = CU.getDWOId()) {
-        assert(RangeListsWritersByCU.count(*DWOId) == 0 &&
-               "RangeLists writer for DWO unit already exists.");
-        auto DWORangeListsSectionWriter =
-            std::make_unique<DebugRangeListsSectionWriter>();
-        DWORangeListsSectionWriter->initSection(CU);
-        DWORangeListsSectionWriter->setAddressWriter(AddrW.get());
-        RangeListsWritersByCU[*DWOId] = std::move(DWORangeListsSectionWriter);
-      }
-      AddressWritersByCU[CU.getOffset()] = std::move(AddrW);
+      [&](DWARFUnit &CU,
+          llvm::DenseMap<uint64_t, uint64_t> &LocListWritersIndexByCU) {
+        std::lock_guard<std::mutex> Lock(AccessMutex);
 
-    } else {
-      auto AddrW =
-          std::make_unique<DebugAddrWriter>(&BC, CU.getAddressByteSize());
-      AddressWritersByCU[CU.getOffset()] = std::move(AddrW);
-      LocListWritersByCU[CUIndex] = std::make_unique<DebugLocWriter>();
-      if (std::optional<uint64_t> DWOId = CU.getDWOId()) {
-        assert(LegacyRangesWritersByCU.count(*DWOId) == 0 &&
-               "LegacyRangeLists writer for DWO unit already exists.");
-        auto LegacyRangesSectionWriterByCU =
-            std::make_unique<DebugRangesSectionWriter>();
-        LegacyRangesSectionWriterByCU->initSection(CU);
-        LegacyRangesWritersByCU[*DWOId] =
-            std::move(LegacyRangesSectionWriterByCU);
-      }
-    }
-    return LocListWritersByCU[CUIndex++].get();
-  };
+        const uint16_t DwarfVersion = CU.getVersion();
+        if (DwarfVersion >= 5) {
+          auto AddrW = std::make_unique<DebugAddrWriterDwarf5>(
+              &BC, CU.getAddressByteSize(), CU.getAddrOffsetSectionBase());
+          RangeListsSectionWriter->setAddressWriter(AddrW.get());
+          LocListWritersByCU[CUIndex] = std::make_unique<DebugLoclistWriter>(
+              CU, DwarfVersion, false, *AddrW);
+
+          if (std::optional<uint64_t> DWOId = CU.getDWOId()) {
+            assert(RangeListsWritersByCU.count(*DWOId) == 0 &&
+                   "RangeLists writer for DWO unit already exists.");
+            auto DWORangeListsSectionWriter =
+                std::make_unique<DebugRangeListsSectionWriter>();
+            DWORangeListsSectionWriter->initSection(CU);
+            DWORangeListsSectionWriter->setAddressWriter(AddrW.get());
+            RangeListsWritersByCU[*DWOId] =
+                std::move(DWORangeListsSectionWriter);
+          }
+          AddressWritersByCU[CU.getOffset()] = std::move(AddrW);
+        } else {
+          auto AddrW =
+              std::make_unique<DebugAddrWriter>(&BC, CU.getAddressByteSize());
+          AddressWritersByCU[CU.getOffset()] = std::move(AddrW);
+          LocListWritersByCU[CUIndex] = std::make_unique<DebugLocWriter>();
+          if (std::optional<uint64_t> DWOId = CU.getDWOId()) {
+            assert(LegacyRangesWritersByCU.count(*DWOId) == 0 &&
+                   "LegacyRangeLists writer for DWO unit already exists.");
+            auto LegacyRangesSectionWriterByCU =
+                std::make_unique<DebugRangesSectionWriter>();
+            LegacyRangesSectionWriterByCU->initSection(CU);
+            LegacyRangesWritersByCU[*DWOId] =
+                std::move(LegacyRangesSectionWriterByCU);
+          }
+        }
+        LocListWritersIndexByCU[CU.getOffset()] = CUIndex++;
+      };
 
   DWARF5AcceleratorTable DebugNamesTable(opts::CreateDebugNames, BC,
                                          *StrWriter);
@@ -677,74 +679,75 @@ void DWARFRewriter::updateDebugInfo() {
   DWPState State;
   if (opts::WriteDWP)
     initDWPState(State);
-  auto processUnitDIE = [&](DWARFUnit *Unit, DIEBuilder *DIEBlder) {
-    // Check if the unit is a skeleton and we need special updates for it and
-    // its matching split/DWO CU.
+  auto processSplitCU = [&](DWARFUnit &Unit, DIEBuilder &DIEBlder) {
     std::optional<DWARFUnit *> SplitCU;
-    std::optional<uint64_t> RangesBase;
-    std::optional<uint64_t> DWOId = Unit->getDWOId();
+    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();
-      }
-
-      updateUnitDebugInfo(*(*SplitCU), DWODIEBuilder, DebugLocDWoWriter,
-                          *TempRangesSectionWriter, *AddressWriter);
-      DebugLocDWoWriter.finalize(DWODIEBuilder,
-                                 *DWODIEBuilder.getUnitDIEbyUnit(**SplitCU));
-      if (Unit->getVersion() >= 5)
-        TempRangesSectionWriter->finalizeSection();
-
-      emitDWOBuilder(DWOName, DWODIEBuilder, *this, **SplitCU, *Unit, State,
-                     DebugLocDWoWriter, DWOStrOffstsWriter, DWOStrWriter,
-                     GDBIndexSection);
+    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);
     }
-
-    if (Unit->getVersion() >= 5) {
-      RangesBase = RangesSectionWriter->getSectionOffset() +
+    DebugStrOffsetsWriter DWOStrOffstsWriter(BC);
+    DebugStrWriter DWOStrWriter((*SplitCU)->getContext(), true);
+    DWODIEBuilder.updateDWONameCompDirForTypes(
+        DWOStrOffstsWriter, DWOStrWriter, **SplitCU, DwarfOutputPath, DWOName);
+    DebugLoclistWriter DebugLocDWoWriter(Unit, Unit.getVersion(), true,
+                                         AddressWriter);
+    DebugRangesSectionWriter *TempRangesSectionWriter =
+        Unit.getVersion() >= 5 ? RangeListsWritersByCU[*DWOId].get()
+                               : LegacyRangesWritersByCU[*DWOId].get();
+
+    updateUnitDebugInfo(*(*SplitCU), DWODIEBuilder, DebugLocDWoWriter,
+                        *TempRangesSectionWriter, AddressWriter);
+    DebugLocDWoWriter.finalize(DWODIEBuilder,
+                               *DWODIEBuilder.getUnitDIEbyUnit(**SplitCU));
+    if (Unit.getVersion() >= 5)
+      TempRangesSectionWriter->finalizeSection();
+
+    emitDWOBuilder(DWOName, DWODIEBuilder, *this, **SplitCU, Unit, State,
+                   DebugLocDWoWriter, DWOStrOffstsWriter, DWOStrWriter,
+                   GDBIndexSection);
+  };
+  auto processMainBinaryCU = [&](DWARFUnit &Unit, DIEBuilder &DIEBlder,
+                                 DebugLocWriter &DebugLocWriter) {
+    DebugAddrWriter &AddressWriter =
+        *AddressWritersByCU[Unit.getOffset()].get();
+    DebugRangesSectionWriter &RangesSectionWriter =
+        Unit.getVersion() >= 5 ? *RangeListsSectionWriter.get()
+                               : *LegacyRangesSectionWriter.get();
+    std::optional<uint64_t> RangesBase;
+    std::optional<DWARFUnit *> SplitCU;
+    std::optional<uint64_t> DWOId = Unit.getDWOId();
+    if (DWOId)
+      SplitCU = BC.getDWOCU(*DWOId);
+    if (Unit.getVersion() >= 5) {
+      RangesBase = RangesSectionWriter.getSectionOffset() +
                    getDWARF5RngListLocListHeaderSize();
-      RangesSectionWriter->initSection(*Unit);
-      StrOffstsWriter->finalizeSection(*Unit, *DIEBlder);
+      RangesSectionWriter.initSection(Unit);
+      StrOffstsWriter->finalizeSection(Unit, DIEBlder);
+    } else if (SplitCU) {
+      RangesBase = LegacyRangesSectionWriter.get()->getSectionOffset();
     }
 
-    updateUnitDebugInfo(*Unit, *DIEBlder, *DebugLocWriter, *RangesSectionWriter,
-                        *AddressWriter, RangesBase);
-    DebugLocWriter->finalize(*DIEBlder, *DIEBlder->getUnitDIEbyUnit(*Unit));
-    if (Unit->getVersion() >= 5)
-      RangesSectionWriter->finalizeSection();
+    updateUnitDebugInfo(Unit, DIEBlder, DebugLocWriter, RangesSectionWriter,
+                        AddressWriter, RangesBase);
+    DebugLocWriter.finalize(DIEBlder, *DIEBlder.getUnitDIEbyUnit(Unit));
+    if (Unit.getVersion() >= 5)
+      RangesSectionWriter.finalizeSection();
   };
 
   DIEBuilder DIEBlder(BC, BC.DwCtx.get(), DebugNamesTable);
@@ -759,25 +762,21 @@ void DWARFRewriter::updateDebugInfo() {
   CUOffsetMap OffsetMap =
       finalizeTypeSections(DIEBlder, *Streamer, GDBIndexSection);
 
-  const bool SingleThreadedMode =
-      opts::NoThreads || opts::DeterministicDebugInfo;
-  if (!SingleThreadedMode)
-    DIEBlder.buildCompileUnits();
-  if (SingleThreadedMode) {
-    CUPartitionVector PartVec = partitionCUs(*BC.DwCtx);
-    for (std::vector<DWARFUnit *> &Vec : PartVec) {
-      DIEBlder.buildCompileUnits(Vec);
-      for (DWARFUnit *CU : DIEBlder.getProcessedCUs())
-        processUnitDIE(CU, &DIEBlder);
-      finalizeCompileUnits(DIEBlder, *Streamer, OffsetMap,
-                           DIEBlder.getProcessedCUs(), *FinalAddrWriter);
+  CUPartitionVector PartVec = partitionCUs(*BC.DwCtx);
+  for (std::vector<DWARFUnit *> &Vec : PartVec) {
+    DIEBlder.buildCompileUnits(Vec);
+    llvm::DenseMap<uint64_t, uint64_t> LocListWritersIndexByCU;
+    for (DWARFUnit *CU : DIEBlder.getProcessedCUs()) {
+      createRangeLocListAddressWriters(*CU, LocListWritersIndexByCU);
+      processSplitCU(*CU, DIEBlder);
     }
-  } else {
-    // Update unit debug info in parallel
-    ThreadPoolInterface &ThreadPool = ParallelUtilities::getThreadPool();
-    for (std::unique_ptr<DWARFUnit> &CU : BC.DwCtx->compile_units())
-      ThreadPool.async(processUnitDIE, CU.get(), &DIEBlder);
-    ThreadPool.wait();
+    for (DWARFUnit *CU : DIEBlder.getProcessedCUs()) {
+      DebugLocWriter *DebugLocWriter =
+          LocListWritersByCU[LocListWritersIndexByCU[CU->getOffset()]].get();
+      processMainBinaryCU(*CU, DIEBlder, *DebugLocWriter);
+    }
+    finalizeCompileUnits(DIEBlder, *Streamer, OffsetMap,
+                         DIEBlder.getProcessedCUs(), *FinalAddrWriter);
   }
 
   DebugNamesTable.emitAccelTable();

>From b754e60d4ab5da8b9a02be1da7589b017f02eb57 Mon Sep 17 00:00:00 2001
From: Sayhaan Siddiqui <sayhaan at meta.com>
Date: Fri, 19 Jul 2024 15:54:17 -0700
Subject: [PATCH 2/4] Updates and formatting changes

---
 bolt/lib/Rewrite/DWARFRewriter.cpp | 64 +++++++++++++++---------------
 1 file changed, 33 insertions(+), 31 deletions(-)

diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 0179ce7d853ad..ea11a24c76b25 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -631,9 +631,9 @@ void DWARFRewriter::updateDebugInfo() {
   uint32_t CUIndex = 0;
   std::mutex AccessMutex;
   // Needs to be invoked in the same order as CUs are processed.
+  llvm::DenseMap<uint64_t, uint64_t> LocListWritersIndexByCU;
   auto createRangeLocListAddressWriters =
-      [&](DWARFUnit &CU,
-          llvm::DenseMap<uint64_t, uint64_t> &LocListWritersIndexByCU) {
+      [&](DWARFUnit &CU) {
         std::lock_guard<std::mutex> Lock(AccessMutex);
 
         const uint16_t DwarfVersion = CU.getVersion();
@@ -679,18 +679,13 @@ void DWARFRewriter::updateDebugInfo() {
   DWPState State;
   if (opts::WriteDWP)
     initDWPState(State);
-  auto processSplitCU = [&](DWARFUnit &Unit, DIEBuilder &DIEBlder) {
-    std::optional<DWARFUnit *> SplitCU;
-    std::optional<uint64_t> DWOId = Unit.getDWOId();
-    if (DWOId)
-      SplitCU = BC.getDWOCU(*DWOId);
-    if (!SplitCU)
-      return;
-    DebugAddrWriter &AddressWriter =
-        *AddressWritersByCU[Unit.getOffset()].get();
-    DIEBuilder DWODIEBuilder(BC, &(*SplitCU)->getContext(), DebugNamesTable,
+  auto processSplitCU = [&](DWARFUnit &Unit, DWARFUnit &SplitCU,
+                            DIEBuilder &DIEBlder,
+                            DebugRangesSectionWriter &TempRangesSectionWriter,
+                            DebugAddrWriter &AddressWriter) {
+    DIEBuilder DWODIEBuilder(BC, &(SplitCU).getContext(), DebugNamesTable,
                              &Unit);
-    DWODIEBuilder.buildDWOUnit(**SplitCU);
+    DWODIEBuilder.buildDWOUnit(SplitCU);
     std::string DWOName = "";
     std::optional<std::string> DwarfOutputPath =
         opts::DwarfOutputPath.empty()
@@ -702,33 +697,31 @@ void DWARFRewriter::updateDebugInfo() {
           *StrOffstsWriter, *StrWriter, Unit, DwarfOutputPath, std::nullopt);
     }
     DebugStrOffsetsWriter DWOStrOffstsWriter(BC);
-    DebugStrWriter DWOStrWriter((*SplitCU)->getContext(), true);
+    DebugStrWriter DWOStrWriter((SplitCU).getContext(), true);
     DWODIEBuilder.updateDWONameCompDirForTypes(
-        DWOStrOffstsWriter, DWOStrWriter, **SplitCU, DwarfOutputPath, DWOName);
+        DWOStrOffstsWriter, DWOStrWriter, SplitCU, DwarfOutputPath, DWOName);
     DebugLoclistWriter DebugLocDWoWriter(Unit, Unit.getVersion(), true,
                                          AddressWriter);
-    DebugRangesSectionWriter *TempRangesSectionWriter =
-        Unit.getVersion() >= 5 ? RangeListsWritersByCU[*DWOId].get()
-                               : LegacyRangesWritersByCU[*DWOId].get();
 
-    updateUnitDebugInfo(*(*SplitCU), DWODIEBuilder, DebugLocDWoWriter,
-                        *TempRangesSectionWriter, AddressWriter);
+    updateUnitDebugInfo(SplitCU, DWODIEBuilder, DebugLocDWoWriter,
+                        TempRangesSectionWriter, AddressWriter);
     DebugLocDWoWriter.finalize(DWODIEBuilder,
-                               *DWODIEBuilder.getUnitDIEbyUnit(**SplitCU));
+                               *DWODIEBuilder.getUnitDIEbyUnit(SplitCU));
     if (Unit.getVersion() >= 5)
-      TempRangesSectionWriter->finalizeSection();
+      TempRangesSectionWriter.finalizeSection();
 
-    emitDWOBuilder(DWOName, DWODIEBuilder, *this, **SplitCU, Unit, State,
+    emitDWOBuilder(DWOName, DWODIEBuilder, *this, SplitCU, Unit, State,
                    DebugLocDWoWriter, DWOStrOffstsWriter, DWOStrWriter,
                    GDBIndexSection);
   };
-  auto processMainBinaryCU = [&](DWARFUnit &Unit, DIEBuilder &DIEBlder,
-                                 DebugLocWriter &DebugLocWriter) {
+  auto processMainBinaryCU = [&](DWARFUnit &Unit, DIEBuilder &DIEBlder) {
     DebugAddrWriter &AddressWriter =
         *AddressWritersByCU[Unit.getOffset()].get();
     DebugRangesSectionWriter &RangesSectionWriter =
         Unit.getVersion() >= 5 ? *RangeListsSectionWriter.get()
                                : *LegacyRangesSectionWriter.get();
+    DebugLocWriter &DebugLocWriter =
+        *LocListWritersByCU[LocListWritersIndexByCU[Unit.getOffset()]].get();
     std::optional<uint64_t> RangesBase;
     std::optional<DWARFUnit *> SplitCU;
     std::optional<uint64_t> DWOId = Unit.getDWOId();
@@ -765,15 +758,24 @@ void DWARFRewriter::updateDebugInfo() {
   CUPartitionVector PartVec = partitionCUs(*BC.DwCtx);
   for (std::vector<DWARFUnit *> &Vec : PartVec) {
     DIEBlder.buildCompileUnits(Vec);
-    llvm::DenseMap<uint64_t, uint64_t> LocListWritersIndexByCU;
     for (DWARFUnit *CU : DIEBlder.getProcessedCUs()) {
-      createRangeLocListAddressWriters(*CU, LocListWritersIndexByCU);
-      processSplitCU(*CU, DIEBlder);
+      createRangeLocListAddressWriters(*CU);
+      std::optional<DWARFUnit *> SplitCU;
+      std::optional<uint64_t> DWOId = CU->getDWOId();
+      if (DWOId)
+        SplitCU = BC.getDWOCU(*DWOId);
+      if (!SplitCU)
+        continue;
+      DebugAddrWriter &AddressWriter =
+          *AddressWritersByCU[CU->getOffset()].get();
+      DebugRangesSectionWriter *TempRangesSectionWriter =
+          CU->getVersion() >= 5 ? RangeListsWritersByCU[*DWOId].get()
+                                : LegacyRangesWritersByCU[*DWOId].get();
+      processSplitCU(*CU, **SplitCU, DIEBlder, *TempRangesSectionWriter,
+                     AddressWriter);
     }
     for (DWARFUnit *CU : DIEBlder.getProcessedCUs()) {
-      DebugLocWriter *DebugLocWriter =
-          LocListWritersByCU[LocListWritersIndexByCU[CU->getOffset()]].get();
-      processMainBinaryCU(*CU, DIEBlder, *DebugLocWriter);
+      processMainBinaryCU(*CU, DIEBlder);
     }
     finalizeCompileUnits(DIEBlder, *Streamer, OffsetMap,
                          DIEBlder.getProcessedCUs(), *FinalAddrWriter);

>From ccb6e497f13e646a07c55a1abc5c1d01c7693d02 Mon Sep 17 00:00:00 2001
From: Sayhaan Siddiqui <sayhaan at meta.com>
Date: Fri, 19 Jul 2024 16:42:34 -0700
Subject: [PATCH 3/4] Formatting changes

---
 bolt/lib/Rewrite/DWARFRewriter.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index ea11a24c76b25..c8e6b756f29a8 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -774,9 +774,8 @@ void DWARFRewriter::updateDebugInfo() {
       processSplitCU(*CU, **SplitCU, DIEBlder, *TempRangesSectionWriter,
                      AddressWriter);
     }
-    for (DWARFUnit *CU : DIEBlder.getProcessedCUs()) {
+    for (DWARFUnit *CU : DIEBlder.getProcessedCUs())
       processMainBinaryCU(*CU, DIEBlder);
-    }
     finalizeCompileUnits(DIEBlder, *Streamer, OffsetMap,
                          DIEBlder.getProcessedCUs(), *FinalAddrWriter);
   }

>From 57a8542cda134cfff3828274d5f4d19826968ee9 Mon Sep 17 00:00:00 2001
From: Sayhaan Siddiqui <sayhaan at meta.com>
Date: Fri, 19 Jul 2024 16:50:28 -0700
Subject: [PATCH 4/4] Formatting changes

---
 bolt/lib/Rewrite/DWARFRewriter.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index c8e6b756f29a8..c729dd4876989 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -632,8 +632,7 @@ void DWARFRewriter::updateDebugInfo() {
   std::mutex AccessMutex;
   // Needs to be invoked in the same order as CUs are processed.
   llvm::DenseMap<uint64_t, uint64_t> LocListWritersIndexByCU;
-  auto createRangeLocListAddressWriters =
-      [&](DWARFUnit &CU) {
+  auto createRangeLocListAddressWriters = [&](DWARFUnit &CU) {
         std::lock_guard<std::mutex> Lock(AccessMutex);
 
         const uint16_t DwarfVersion = CU.getVersion();



More information about the llvm-commits mailing list