[llvm] [llvm][DebugInfo] Attach object-pointer to DISubprogram declarations (PR #122742)

Michael Buch via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 05:30:51 PST 2025


Michael137 wrote:

@dwblaikie 
```
$ bloaty `find build-debug-with-patch/lib -name *.o`  │$ bloaty `find build-debug-no-patch/lib -name *.o`  │$ bloaty `find build-debug-implicit-const/lib -name *.o`
    FILE SIZE        VM SIZE                          │    FILE SIZE        VM SIZE                        │    FILE SIZE        VM SIZE    
 --------------  --------------                       │ --------------  --------------                     │ --------------  -------------- 
  54.5%  2.33Gi  59.5%  2.33Gi    ,__debug_str        │  55.6%  2.33Gi  60.9%  2.33Gi    ,__debug_str      │  55.6%  2.33Gi  60.9%  2.33Gi    ,__debug_str
  20.5%   896Mi  22.4%   896Mi    ,__debug_info       │  18.8%   807Mi  20.6%   807Mi    ,__debug_info     │  18.9%   808Mi  20.6%   808Mi    ,__debug_info
   5.5%   240Mi   0.0%       0    String Table        │   5.6%   240Mi   0.0%       0    String Table      │   5.6%   240Mi   0.0%       0    String Table
   4.2%   184Mi   4.6%   184Mi    ,__text             │   4.3%   184Mi   4.7%   184Mi    ,__text           │   4.3%   184Mi   4.7%   184Mi    ,__text
   3.6%   157Mi   3.9%   157Mi    ,__debug_names      │   3.7%   157Mi   4.0%   157Mi    ,__debug_names    │   3.7%   157Mi   4.0%   157Mi    ,__debug_names
   3.3%   143Mi   3.6%   143Mi    ,__debug_str_offs   │   3.4%   143Mi   3.7%   143Mi    ,__debug_str_offs │   3.3%   143Mi   3.7%   143Mi    ,__debug_str_offs
   2.0%  88.4Mi   0.0%       0    [Unmapped]          │   2.1%  88.4Mi   0.0%       0    [Unmapped]        │   2.1%  88.4Mi   0.0%       0    [Unmapped]
   1.8%  79.8Mi   2.0%  79.8Mi    ,__debug_line       │   1.9%  79.8Mi   2.0%  79.8Mi    ,__debug_line     │   1.9%  79.8Mi   2.0%  79.8Mi    ,__debug_line
   1.6%  67.9Mi   1.7%  67.9Mi    ,__compact_unwind   │   1.6%  67.9Mi   1.7%  67.9Mi    ,__compact_unwind │   1.6%  67.9Mi   1.7%  67.9Mi    ,__compact_unwind
   0.9%  41.2Mi   0.0%       0    Symbol Table        │   1.0%  41.2Mi   0.0%       0    Symbol Table      │   1.0%  41.2Mi   0.0%       0    Symbol Table
   0.7%  31.6Mi   0.8%  31.6Mi    ,__debug_line_str   │   0.7%  31.6Mi   0.8%  31.6Mi    ,__debug_line_str │   0.7%  31.6Mi   0.8%  31.6Mi    ,__debug_line_str
   0.5%  20.9Mi   0.5%  20.9Mi    ,__debug_addr       │   0.5%  20.9Mi   0.5%  20.9Mi    ,__debug_addr     │   0.5%  20.9Mi   0.5%  20.9Mi    ,__debug_addr
   0.4%  17.0Mi   0.4%  17.0Mi    ,__const            │   0.4%  17.0Mi   0.4%  17.0Mi    ,__const          │   0.4%  17.0Mi   0.4%  17.0Mi    ,__const
   0.2%  9.40Mi   0.2%  9.40Mi    ,__debug_abbrev     │   0.2%  8.95Mi   0.2%  8.95Mi    ,__cstring        │   0.2%  9.54Mi   0.2%  9.54Mi    ,__debug_abbrev
   0.2%  8.95Mi   0.2%  8.95Mi    ,__cstring          │   0.2%  8.61Mi   0.2%  8.61Mi    ,__debug_abbrev   │   0.2%  8.95Mi   0.2%  8.95Mi    ,__cstring
   0.1%  2.58Mi   0.0%       0    [Mach-O Headers]    │   0.1%  2.58Mi   0.0%       0    [Mach-O Headers]  │   0.1%  2.58Mi   0.0%       0    [Mach-O Headers]
   0.0%   482Ki   0.0%   482Ki    ,__StaticInit       │   0.0%   482Ki   0.0%   482Ki    ,__StaticInit     │   0.0%   482Ki   0.0%   482Ki    ,__StaticInit
   0.0%       0   0.0%   464Ki    ,__bss              │   0.0%       0   0.0%   464Ki    ,__bss            │   0.0%       0   0.0%   464Ki    ,__bss
   0.0%   342Ki   0.0%   342Ki    ,__data             │   0.0%   342Ki   0.0%   342Ki    ,__data           │   0.0%   342Ki   0.0%   342Ki    ,__data
   0.0%   188Ki   0.0%   188Ki    ,__debug_rnglists   │   0.0%   188Ki   0.0%   188Ki    ,__debug_rnglists │   0.0%   188Ki   0.0%   188Ki    ,__debug_rnglists
   0.0%  22.1Ki   0.0%  57.8Ki    [10 Others]         │   0.0%  22.1Ki   0.0%  57.8Ki    [10 Others]       │   0.0%  22.1Ki   0.0%  57.8Ki    [10 Others]
 100.0%  4.27Gi 100.0%  3.91Gi    TOTAL               │ 100.0%  4.19Gi 100.0%  3.82Gi    TOTAL             │ 100.0%  4.19Gi 100.0%  3.82Gi    TOTAL
```

Here are some results of the bootstrapped build (with and without this patch reverted and also replacing the `DW_FORM_ref4` with `DW_FORM_implicit_const`). The `implicit_const` version pretty much has a negligible effect on the `.debug_info` (and total) size. Though it does increase the `.debug_abbrev` from `8.61 Mi` to `9.54 Mi`. The current patch does increase the `.debug_info` section by ~11% which aligns with what you were seeing.

Just looking at the dwarfdump I don't see anything surprising that would indicate a bug here. A lot more methods just have the `DW_AT_object_pointer`. E.g., the number of `DW_AT_object_pointer`s occurrences in `libclangASTMatchers.a` increased from `19,650` to `169,958` (which would be ~600 KB worth of extra references). Which is pretty much exactly the amount by which that particular archive increased. The only diff in the dwarfdump's is the existence of this attribute

Based on this, are you fine with going ahead with changing `DW_FORM_*`. Or is there anything else worth looking at with the current regression?

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


More information about the llvm-commits mailing list