[llvm] [RFC][BOLT] Add a new parallel DWARF processing(2/2) (PR #197859)

Jinjie Huang via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 04:17:41 PDT 2026


Jinjie-Huang wrote:

This PR changes almost the entire pipeline, rather than being just a localized modification. The new pipeline introduces quite a bit of state with different lifetimes: global writers, per-CU writers, per-bucket writers, bucket DIEBuilders, merge offsets, debug names / GDB index state, etc. Right now, most of these are managed procedurally in updateDebugInfo(). Could we consider using RAII-style scoped objects(maybe with a separate rewriter context?) to keep these declarations grouped within their corresponding modules / phases? That would make the lifetime of each resource explicit and keep variables declared near the phase where they are used. Ideally, the flow could perhaps be reorganized into something like this:
```
void DWARFRewriter::updateDebugInfo() {
  // Step 1: Initialize DWARF writers。
  initializeWriters();
  // Step 2: Partitioning.
  partitionCUs();
  // Step 3: Process buckets in parallel.
  processCU();
  // Step 4: Merge completed buckets.
  mergeCUPartitionResults();
  // Step 5: Emit final global debug sections and indexes.
  finalize();
  ...
}
```
But this is probably not a blocking issue, perhaps we could track this and address it in a follow-up PR?


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


More information about the llvm-commits mailing list