Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssa: implement #[collapse_debuginfo] #99556

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

davidtwco
Copy link
Member

cc #39153 rust-lang/compiler-team#386

Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using -Zdebug-macros disables this behaviour.

When the collapse_debuginfo feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the #[collapse_debuginfo] attribute is available and can be applied to macro definitions which will then have their line information collapsed.

r? rust-lang/wg-debugging

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 21, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jul 21, 2022

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 21, 2022
@davidtwco
Copy link
Member Author

Relevant Zulip discussions are here and here.

@davidtwco
Copy link
Member Author

davidtwco commented Jul 21, 2022

It might make sense to add the #[collapse_debuginfo] attributes to std macros in this pull request, happy to do that if people agree.

@davidtwco davidtwco force-pushed the collapse-debuginfo branch from 8719132 to 85282ea Compare July 21, 2022 14:11
@davidtwco davidtwco force-pushed the collapse-debuginfo branch from 85282ea to b40a375 Compare July 21, 2022 16:01
@rust-log-analyzer

This comment has been minimized.

@michaelwoerister
Copy link
Member

Thanks for the PR, @davidtwco! I've set aside some time to read up on the discussion early next week. I guess, technically, we'll need to wait for the MCP to be accepted anyway :)

@bors

This comment was marked as resolved.

@davidtwco davidtwco force-pushed the collapse-debuginfo branch from b40a375 to 699e90d Compare July 27, 2022 09:50
@rust-log-analyzer

This comment has been minimized.

@bors

This comment was marked as resolved.

@davidtwco davidtwco force-pushed the collapse-debuginfo branch from 699e90d to 0e47d53 Compare July 28, 2022 08:21
@rust-log-analyzer

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@davidtwco davidtwco force-pushed the collapse-debuginfo branch from 0e47d53 to 3376976 Compare August 9, 2022 13:22
@rust-log-analyzer

This comment has been minimized.

@bors

This comment was marked as resolved.

@rust-log-analyzer

This comment was marked as resolved.

@michaelwoerister
Copy link
Member

Alright, I'll finally have some time to take a look at this topic! Sorry for the wait, @davidtwco.

Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks excellent! Great tests. Thanks for the PR, @davidtwco!

I left a few comments below. Looks like a tracking issue is needed for CI to pass.

compiler/rustc_feature/src/active.rs Outdated Show resolved Hide resolved
compiler/rustc_passes/src/check_attr.rs Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Sep 7, 2022

☀️ Try build successful - checks-actions
Build commit: 83669ee9a36dfe33adff2c816a6c19fc2b31f751 (83669ee9a36dfe33adff2c816a6c19fc2b31f751)

@rust-timer
Copy link
Collaborator

Queued 83669ee9a36dfe33adff2c816a6c19fc2b31f751 with parent 0568b0a, future comparison URL.

Debuginfo line information for macro invocations are collapsed by
default - line information are replaced by the line of the outermost
expansion site. Using `-Zdebug-macros` disables this behaviour.

When the `collapse_debuginfo` feature is enabled, the default behaviour
is reversed so that debuginfo is not collapsed by default. In addition,
the `#[collapse_debuginfo]` attribute is available and can be applied to
macro definitions which will then have their line information collapsed.

Signed-off-by: David Wood <david.wood@huawei.com>
@rust-log-analyzer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (83669ee9a36dfe33adff2c816a6c19fc2b31f751): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

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

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.8% [-1.3%, -0.4%] 12
Improvements ✅
(secondary)
-1.4% [-2.0%, -0.5%] 9
All ❌✅ (primary) -0.8% [-1.3%, -0.4%] 12

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-4.1%, -3.5%] 2
All ❌✅ (primary) - - 0

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot removed S-waiting-on-perf Status: Waiting on a perf run to be completed. perf-regression Performance regression. labels Sep 7, 2022
@davidtwco
Copy link
Member Author

r? @wesleywiser

@wesleywiser
Copy link
Member

Thanks @davidtwco! 👍

@bors r+

@bors
Copy link
Contributor

bors commented Sep 12, 2022

📌 Commit 38958aa has been approved by wesleywiser

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 12, 2022
@bors
Copy link
Contributor

bors commented Sep 13, 2022

⌛ Testing commit 38958aa with merge 0df1ddc...

@bors
Copy link
Contributor

bors commented Sep 13, 2022

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing 0df1ddc to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 13, 2022
@bors bors merged commit 0df1ddc into rust-lang:master Sep 13, 2022
@rustbot rustbot added this to the 1.65.0 milestone Sep 13, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0df1ddc): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.8% [3.8%, 3.8%] 1
Improvements ✅
(primary)
-3.3% [-3.3%, -3.3%] 1
Improvements ✅
(secondary)
-1.8% [-3.4%, -0.5%] 4
All ❌✅ (primary) -3.3% [-3.3%, -3.3%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
2.6% [2.6%, 2.6%] 1
Regressions ❌
(secondary)
0.6% [0.6%, 0.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.6% [2.6%, 2.6%] 1

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@davidtwco davidtwco deleted the collapse-debuginfo branch September 13, 2022 08:20
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Oct 23, 2022
…ywiser

ssa: implement `#[collapse_debuginfo]`

cc rust-lang#39153 rust-lang/compiler-team#386

Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour.

When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed.

r? rust-lang/wg-debugging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic F-collapse_debuginfo `#![feature(collapse_debuginfo)]` merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants