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

coverage: Don't rely on the custom traversal to find enclosing loops #132091

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

Zalathar
Copy link
Contributor

This opens up the possibility of modifying or removing the custom graph traversal used in coverage counter creation, without losing access to the heuristics that care about a node's enclosing loops.

Actually changing the traversal is left for future work, because this PR on its own doesn't change the emitted coverage mappings at all.

@Zalathar Zalathar added the A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) label Oct 24, 2024
@rustbot
Copy link
Collaborator

rustbot commented Oct 24, 2024

r? @saethlin

rustbot has assigned @saethlin.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added 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. labels Oct 24, 2024
@rustbot
Copy link
Collaborator

rustbot commented Oct 24, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@Zalathar Zalathar force-pushed the graph-loops branch 2 times, most recently from 88a4970 to e9a7bb4 Compare October 24, 2024 07:31
@Zalathar
Copy link
Contributor Author

Zalathar commented Oct 24, 2024

Clarified that dominator order doesn't have to be reverse postorder; that's just what it currently is (diff).

Copy link
Contributor

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

lgtm

compiler/rustc_mir_transform/src/coverage/graph.rs Outdated Show resolved Hide resolved
pub(crate) fn loop_headers_containing(
&self,
bcb: BasicCoverageBlock,
) -> impl Iterator<Item = BasicCoverageBlock> + Captures<'_> {
Copy link
Contributor

Choose a reason for hiding this comment

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

just a side note here, the Rust 1.82 release notes mention that we now have dedicated use<> syntax to replace Captures, and this eventually becoming the default in Rust 2024.
Though I believe + '_ would also work here, as the &self lifelime is the only one captured here?

I also don’t really know what the current conventions for compiler code are related to all this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, is that stable now? Nice.

I think I'm going to stick with Captures for now. After the compiler switches over to Rust 2024, someone will probably go through and try to rip out unnecessary uses of Captures, and it will be easier to find and migrate this code if it matches the prevailing style in the rest of the compiler.

@saethlin
Copy link
Member

:shipit:
@bors r+

@bors
Copy link
Contributor

bors commented Oct 27, 2024

📌 Commit 19b2142 has been approved by saethlin

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. labels Oct 27, 2024
@bors
Copy link
Contributor

bors commented Oct 27, 2024

⌛ Testing commit 19b2142 with merge e454c45...

@bors
Copy link
Contributor

bors commented Oct 27, 2024

☀️ Test successful - checks-actions
Approved by: saethlin
Pushing e454c45 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 27, 2024
@bors bors merged commit e454c45 into rust-lang:master Oct 27, 2024
7 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 27, 2024
@Zalathar Zalathar deleted the graph-loops branch October 27, 2024 10:43
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e454c45): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

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

Max RSS (memory usage)

Results (primary 1.4%)

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.

mean range count
Regressions ❌
(primary)
1.4% [1.3%, 1.5%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.4% [1.3%, 1.5%] 3

Cycles

Results (primary 1.1%)

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.

mean range count
Regressions ❌
(primary)
1.1% [1.1%, 1.2%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.1% [1.1%, 1.2%] 3

Binary size

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

Bootstrap: 783.844s -> 783.471s (-0.05%)
Artifact size: 333.65 MiB -> 333.71 MiB (0.02%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants