Skip to content

debuginfo: emit DW_TAG_call_site entries on optimized builds#154532

Open
resrever wants to merge 1 commit intorust-lang:mainfrom
resrever:enable-dwarf-call-sites-v2
Open

debuginfo: emit DW_TAG_call_site entries on optimized builds#154532
resrever wants to merge 1 commit intorust-lang:mainfrom
resrever:enable-dwarf-call-sites-v2

Conversation

@resrever
Copy link
Copy Markdown
Contributor

@resrever resrever commented Mar 29, 2026

This is a follow-up to #154200, which was reverted in #154468. The perf metrics showed an average increase of ~2% in binary size and 0.5% compile-time, which is expected due to the space and processing of the DW_TAG_call_site entries.

What this PR does different is gate it behind optimized builds. DW_TAG_call_site is only useful on debug symbols with optimized builds anyway, because unoptimized builds have clear call sites with no tail calls. This behavior also aligns with Clang.

Only one binary in the perf suite - ripgrep - uses debug+optimized builds, so the performance impact is expected to remain, but with that cost comes the benefit of improved debuggability.

r? dingxiangfei2009

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 29, 2026
@resrever resrever marked this pull request as ready for review March 29, 2026 06:00
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 29, 2026
@Kobzol
Copy link
Copy Markdown
Member

Kobzol commented Mar 29, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 29, 2026
debuginfo: emit DW_TAG_call_site entries on optimized builds
@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 29, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 29, 2026

☀️ Try build successful (CI)
Build commit: 1959f8b (1959f8b227e8d49591068fd085a39fa40008c390, parent: 148adf223edb0444eb1f99753919dd2080c2a534)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (1959f8b): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.7% [0.2%, 1.0%] 6
Regressions ❌
(secondary)
0.6% [0.3%, 1.0%] 14
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.2%, 1.0%] 6

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (primary -2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.4% [-2.4%, -2.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.4% [-2.4%, -2.4%] 1

Binary size

Results (primary 1.4%, secondary 1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.4% [0.8%, 2.1%] 16
Regressions ❌
(secondary)
1.8% [0.1%, 2.1%] 45
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.4% [0.8%, 2.1%] 16

Bootstrap: 492.806s -> 486.147s (-1.35%)
Artifact size: 394.85 MiB -> 395.10 MiB (0.06%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 29, 2026
@resrever
Copy link
Copy Markdown
Contributor Author

As expected, ripgrep is showing an increase because it is generating debug symbols with optimization.

I did not anticipate the helloworld regression, but after some digging it looks like std is compiled with opt-level 3 before being included in helloworld, so this is working as intended. This brings the standard practice of callsite records that Clang and GCC emit to rustc, and it gates it behind optimization like getCallSiteRelatedAttrs() in CGDebugInfo.cpp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants