[PATCH] D151909: [BOLT][DWARF] Change to process and write out TUs first, then CUs in batches.

Maksim Panchenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 18:24:03 PDT 2023


maksfb added a comment.

Please update the summary and include runtime memory data.



================
Comment at: bolt/include/bolt/Core/DIEBuilder.h:63
 
+  enum class ProcessingType { DWARF4TYPES, DWARF5TYPES, CUs };
+
----------------
Maybe?


================
Comment at: bolt/lib/Core/DIEBuilder.cpp:254
+  BuilderState.reset(new State());
+  // Initizliaing to full size because there could be cross CU references with
+  // different abbrev offsets. LLVM happens to output CUs that have cross CU
----------------



================
Comment at: bolt/lib/Core/DIEBuilder.cpp:262
+  getState().Type = ProcessingType::CUs;
+  for (DWARFUnit *CU : CUs) {
+    registerUnit(*CU, false);
----------------
nit: braces


================
Comment at: bolt/lib/Core/DIEBuilder.cpp:841
+    return;
+  if (getState().Type == ProcessingType::DWARF4TYPES)
+    getState().DWARF4TUVector.push_back(&DU);
----------------
Use braces.


================
Comment at: bolt/lib/Rewrite/DWARFRewriter.cpp:247
+        "better performance, but more memory usage. Default value is 1."),
+    cl::ZeroOrMore, cl::Hidden, cl::init(1), cl::cat(BoltCategory));
 } // namespace opts
----------------
Not needed.


================
Comment at: bolt/lib/Rewrite/DWARFRewriter.cpp:451
+using CUPartitionVector = std::vector<DWARFUnitVec>;
+static CUPartitionVector partitionCUs(DWARFContext &DwCtx) {
+  CUPartitionVector Vec(2);
----------------
Add documentation.


================
Comment at: bolt/lib/Rewrite/DWARFRewriter.cpp:470
+    }
+    if (CrossCURefFound)
+      Vec[0].push_back(CU.get());
----------------
Add braces.


================
Comment at: bolt/lib/Rewrite/DWARFRewriter.cpp:646
+
+  bool SingleMode = opts::NoThreads || opts::DeterministicDebugInfo;
+  if (!SingleMode)
----------------



================
Comment at: bolt/lib/Rewrite/DWARFRewriter.cpp:1337
+
+  for (const SectionRef &Secs : Obj->sections()) {
+    StringRef Contents = cantFail(Secs.getContents());
----------------
`Secs`?


================
Comment at: bolt/lib/Rewrite/DWARFRewriter.cpp:1459
+    emitUnit(DIEBlder, Streamer, *CU);
+    uint32_t StartOffset = CUOffset;
+    DIE *UnitDIE = DIEBlder.getUnitDIEbyUnit(*CU);
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151909



More information about the llvm-commits mailing list