[all-commits] [llvm/llvm-project] 52c30b: [BOLT] Stop materializing .dwo DIE vectors early i...

Rafael Auler via All-commits all-commits at lists.llvm.org
Tue Jul 14 17:05:59 PDT 2026


  Branch: refs/heads/users/rafaelauler/fix-dbginfo-rss
  Home:   https://github.com/llvm/llvm-project
  Commit: 52c30b3e06ab2a4ddd2beeac183d23978ec9cbaa
      https://github.com/llvm/llvm-project/commit/52c30b3e06ab2a4ddd2beeac183d23978ec9cbaa
  Author: Rafael Auler <rafaelauler at fb.com>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M bolt/lib/Core/BinaryContext.cpp
    M bolt/lib/Core/DIEBuilder.cpp

  Log Message:
  -----------
  [BOLT] Stop materializing .dwo DIE vectors early in the pipeline

Summary: preprocessDWODebugInfo() eagerly force-extracted every .dwo
compile unit's DIE tree (getNonSkeletonUnitDIE(false)) very early in
BOLT pipeline, way before DWARFRewriter kicked in. Those vectors then
sit in memory throughout the entire rewrite pipeline, directly
contributing to BOLT's RSS peak. I did a fair amount of digging and
didn't find any reason as to why we need to keep all DIEs of DWO CU
materialized at all, since DWARFRewriter won't even read this vector
(the #197359 concurrency fix did use that, but that is unnecessary).
The problem is that these DIE trees are a massive contribution to RSS
when processing large binaries where we have 10s of K of dwos, storing
complete trees for each processed dwo.

This diff changes the #197359 concurrency fix to not rely on the DIE
sibling/children structure. It parses DWP type units selectively per
compile unit (DIEBuilder::buildDWPTypeUnitsForUnit ->
collectReferencedTypeSignatures) by finding the DW_FORM_ref_sig8
references in a unit's DIEs to decide which type units belong in that
unit's output .dwo. That walk previously used DWARFDie::children(),
which requires the unit's full DIE vector. Here we rewrite the walk to
stream the unit's DIEs one at a time with
DWARFDebugInfoEntry::extractFast (the same technique already used by
DIEBuilder::constructFromUnit and DWARFRewriter::partitionCUs),
reading DW_FORM_ref_sig8 attributes off a single reusable transient
entry. The tree structure is irrelevant -- every DIE in the unit is
visited regardless -- so no DIE vector is
built. collectReferencedTypeSignatures now takes a DWARFUnit& instead
of a DWARFDie.

With the walk self-sufficient:
- preprocessDWODebugInfo() now extracts only the .dwo CU DIE
  (getNonSkeletonUnitDIE(true)); nothing reads the full array off it anymore
  (constructFromUnit and the signature walk both stream).
- BinaryContext::collectDebugScopeBoundaries() drops its split-DWARF
  fast-path, which called DWARFUnit::dies() (= full extraction); DWO units are
  now streamed like monolithic ones.

The result is that .dwo DIE vectors are never materialized during
BOLT processing.

Expected to be a ~10% RSS win on large split-dwarf binaries.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list