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: Defer part of counter-creation until codegen #136053

Merged
merged 4 commits into from
Feb 10, 2025

Conversation

Zalathar
Copy link
Contributor

Follow-up to #135481 and #135873.

One of the pleasant properties of the new counter-assignment algorithm is that we can stop partway through the process, store the intermediate state in MIR, and then resume the rest of the algorithm during codegen. This lets it take into account which parts of the control-flow graph were eliminated by MIR opts, resulting in fewer physical counters and simpler counter expressions.

Those improvements end up completely obsoleting much larger chunks of code that were previously responsible for cleaning up the coverage metadata after MIR opts, while also doing a more thorough cleanup job.

(That change also unlocks some further simplifications that I've kept out of this PR to limit its scope.)

@Zalathar Zalathar added the A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) label Jan 25, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2025

r? @fmease

rustbot has assigned @fmease.
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 Jan 25, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@saethlin
Copy link
Member

r? codegen

@rustbot rustbot assigned saethlin and unassigned fmease Jan 27, 2025
@bors
Copy link
Contributor

bors commented Jan 27, 2025

☔ The latest upstream changes (presumably #136135) made this pull request unmergeable. Please resolve the merge conflicts.

@Zalathar
Copy link
Contributor Author

Rebased to fix trivial conflict; no change.

@Zalathar
Copy link
Contributor Author

Tweaked some outdated comments (diff).

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Feb 6, 2025

☔ The latest upstream changes (presumably #136613) made this pull request unmergeable. Please resolve the merge conflicts.

@Zalathar
Copy link
Contributor Author

Zalathar commented Feb 6, 2025

Rebased to resolve conflict in structural_impls.rs; turns out I don't even need that impl anyway (due to #135873) so it's just gone now.

@saethlin
Copy link
Member

saethlin commented Feb 8, 2025

@bors r+ rollup=iffy conflicty

@bors
Copy link
Contributor

bors commented Feb 8, 2025

📌 Commit bd855b6 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 Feb 8, 2025
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Feb 10, 2025
coverage: Defer part of counter-creation until codegen

Follow-up to rust-lang#135481 and rust-lang#135873.

One of the pleasant properties of the new counter-assignment algorithm is that we can stop partway through the process, store the intermediate state in MIR, and then resume the rest of the algorithm during codegen. This lets it take into account which parts of the control-flow graph were eliminated by MIR opts, resulting in fewer physical counters and simpler counter expressions.

Those improvements end up completely obsoleting much larger chunks of code that were previously responsible for cleaning up the coverage metadata after MIR opts, while also doing a more thorough cleanup job.

(That change also unlocks some further simplifications that I've kept out of this PR to limit its scope.)
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
…kingjubilee

Rollup of 4 pull requests

Successful merges:

 - rust-lang#133092 (Always set the deployment target when building std)
 - rust-lang#134626 (Add Four Codegen Tests)
 - rust-lang#136053 (coverage: Defer part of counter-creation until codegen)
 - rust-lang#136707 (Bump `cc` to v1.2.12 for the compiler workspace)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 10, 2025
coverage: Defer part of counter-creation until codegen

Follow-up to rust-lang#135481 and rust-lang#135873.

One of the pleasant properties of the new counter-assignment algorithm is that we can stop partway through the process, store the intermediate state in MIR, and then resume the rest of the algorithm during codegen. This lets it take into account which parts of the control-flow graph were eliminated by MIR opts, resulting in fewer physical counters and simpler counter expressions.

Those improvements end up completely obsoleting much larger chunks of code that were previously responsible for cleaning up the coverage metadata after MIR opts, while also doing a more thorough cleanup job.

(That change also unlocks some further simplifications that I've kept out of this PR to limit its scope.)
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang#134626 (Add Four Codegen Tests)
 - rust-lang#136053 (coverage: Defer part of counter-creation until codegen)
 - rust-lang#136228 (Simplify Rc::as_ptr docs + typo fix)
 - rust-lang#136487 (ci: stop mysql before removing it)
 - rust-lang#136790 (Git blame ignore recent formatting commit)
 - rust-lang#136803 (Subtree update of `rust-analyzer`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang#134626 (Add Four Codegen Tests)
 - rust-lang#136053 (coverage: Defer part of counter-creation until codegen)
 - rust-lang#136228 (Simplify Rc::as_ptr docs + typo fix)
 - rust-lang#136487 (ci: stop mysql before removing it)
 - rust-lang#136790 (Git blame ignore recent formatting commit)
 - rust-lang#136803 (Subtree update of `rust-analyzer`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
…kingjubilee

Rollup of 12 pull requests

Successful merges:

 - rust-lang#136053 (coverage: Defer part of counter-creation until codegen)
 - rust-lang#136201 (Removed dependency on the field-offset crate, alternate approach)
 - rust-lang#136228 (Simplify Rc::as_ptr docs + typo fix)
 - rust-lang#136353 (fix(libtest): Enable Instant on Emscripten targets)
 - rust-lang#136472 ([`compiletest`-related cleanups 2/7] Feed stage number to compiletest directly)
 - rust-lang#136487 (ci: stop mysql before removing it)
 - rust-lang#136552 (Use an `Option` for `FindNextFileHandle` in `ReadDir` instead of `INVALID_FILE_HANDLE` sentinel value)
 - rust-lang#136705 (Some miscellaneous edition-related library tweaks)
 - rust-lang#136707 (Bump `cc` to v1.2.13 for the compiler workspace)
 - rust-lang#136790 (Git blame ignore recent formatting commit)
 - rust-lang#136792 (Don't apply editorconfig to llvm)
 - rust-lang#136805 (ignore win_delete_self test in Miri)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7f8108a into rust-lang:master Feb 10, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 10, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 10, 2025
Rollup merge of rust-lang#136053 - Zalathar:defer-counters, r=saethlin

coverage: Defer part of counter-creation until codegen

Follow-up to rust-lang#135481 and rust-lang#135873.

One of the pleasant properties of the new counter-assignment algorithm is that we can stop partway through the process, store the intermediate state in MIR, and then resume the rest of the algorithm during codegen. This lets it take into account which parts of the control-flow graph were eliminated by MIR opts, resulting in fewer physical counters and simpler counter expressions.

Those improvements end up completely obsoleting much larger chunks of code that were previously responsible for cleaning up the coverage metadata after MIR opts, while also doing a more thorough cleanup job.

(That change also unlocks some further simplifications that I've kept out of this PR to limit its scope.)
@Zalathar Zalathar deleted the defer-counters branch February 10, 2025 23:30
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) 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