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

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 11:34:27 PDT 2024


================
@@ -767,17 +769,28 @@ void DWARFRewriter::updateDebugInfo() {
     CUPartitionVector PartVec = partitionCUs(*BC.DwCtx);
     for (std::vector<DWARFUnit *> &Vec : PartVec) {
       DIEBlder.buildCompileUnits(Vec);
-      for (DWARFUnit *CU : DIEBlder.getProcessedCUs())
-        processUnitDIE(CU, &DIEBlder);
+      llvm::SmallVector<DWARFUnit *> CompileUnits(
+          std::begin(DIEBlder.getProcessedCUs()),
+          std::end(DIEBlder.getProcessedCUs()));
+      llvm::DenseMap<uint64_t, uint64_t> LocListWritersIndexByCU;
+      for (DWARFUnit *CU : CompileUnits) {
+        createRangeLocListAddressWriters(*CU, LocListWritersIndexByCU);
+        processSplitCU(CU, &DIEBlder);
+      }
+      for (DWARFUnit *CU : CompileUnits) {
+        DebugLocWriter *DebugLocWriter =
+            LocListWritersByCU[LocListWritersIndexByCU[CU->getOffset()]].get();
+        processMainBinaryCU(CU, &DIEBlder, DebugLocWriter);
+      }
       finalizeCompileUnits(DIEBlder, *Streamer, OffsetMap,
                            DIEBlder.getProcessedCUs(), *FinalAddrWriter);
     }
   } 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();
+      // ThreadPool.async(processUnitDIE, CU.get(), &DIEBlder);
----------------
ayermolo wrote:

Remove this change

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


More information about the llvm-commits mailing list