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

Only run MaybeInitializedPlaces dataflow once to elaborate drops #111555

Merged
merged 17 commits into from
Aug 17, 2023

Conversation

cjgillot
Copy link
Contributor

@cjgillot cjgillot commented May 14, 2023

This pass allows forward dataflow analyses to modify the CFG depending on the dataflow state. This possibility is used for the MaybeInitializedPlace analysis in drop elaboration, to skip the dataflow effect of dead unwinds without having to compute dataflow twice.

@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 May 14, 2023
@cjgillot
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 14, 2023
@bors
Copy link
Contributor

bors commented May 14, 2023

⌛ Trying commit 6185b06e28ff0e0699b0b4c13f8a1375371cc13e with merge 4436f122442131f57e5dcd6b62dd883bfd5e8204...

@bors
Copy link
Contributor

bors commented May 14, 2023

☀️ Try build successful - checks-actions
Build commit: 4436f122442131f57e5dcd6b62dd883bfd5e8204 (4436f122442131f57e5dcd6b62dd883bfd5e8204)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4436f122442131f57e5dcd6b62dd883bfd5e8204): 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-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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-1.2%, -0.3%] 30
Improvements ✅
(secondary)
-0.9% [-1.3%, -0.2%] 29
All ❌✅ (primary) -0.7% [-1.2%, -0.3%] 30

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.9% [1.4%, 2.2%] 3
Improvements ✅
(primary)
-4.6% [-5.2%, -4.3%] 3
Improvements ✅
(secondary)
-8.8% [-13.2%, -2.2%] 3
All ❌✅ (primary) -4.6% [-5.2%, -4.3%] 3

Cycles

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

Binary size

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

Bootstrap: 660.613s -> 659.115s (-0.23%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 14, 2023
@cjgillot cjgillot marked this pull request as ready for review May 14, 2023 14:09
@rustbot
Copy link
Collaborator

rustbot commented May 14, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@cjgillot
Copy link
Contributor Author

r? compiler

compiler/rustc_middle/src/mir/terminator.rs Outdated Show resolved Hide resolved
compiler/rustc_mir_dataflow/src/impls/liveness.rs Outdated Show resolved Hide resolved
compiler/rustc_mir_dataflow/src/impls/liveness.rs Outdated Show resolved Hide resolved
Comment on lines 79 to 82
let mut reachable = BitSet::new_empty(body.basic_blocks.len());
for bb in body.basic_blocks.indices() {
if inits.results().entry_set_for_block(bb).is_reachable() {
reachable.insert(bb);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like reachable and all uses that follow could be removed now. Do you think it is still useful? As I understand, this boils down to difference between unreachable unelaborated drop, and unreachable elaborated drop that doesn't drop anything. So it might be simpler to just remove this.

Although, in any case, to minimize the diff I would leave that for a potential followup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is still used to avoid a seek into an unreachable block. The dataflow framework ICEs in certain conditions in those cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

Initially there are no structurally unreachable blocks (in a sense of traversal::reachable), so we can execute the dataflow engine without running into ICE. In the new approach, the subsequent execution of dataflow engine uses the same MIR body, so we shouldn't have any structurally unreachable blocks still.

compiler/rustc_mir_dataflow/src/framework/direction.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented May 27, 2023

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

@cjgillot cjgillot force-pushed the elaborate-drops branch 2 times, most recently from 261b20e to 168e725 Compare May 28, 2023 06:49
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jun 27, 2023

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

@bors
Copy link
Contributor

bors commented Jul 3, 2023

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

@rust-log-analyzer

This comment has been minimized.

@tmiasko
Copy link
Contributor

tmiasko commented Aug 16, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Aug 16, 2023

📌 Commit 5b2524e has been approved by tmiasko

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 Aug 16, 2023
@bors
Copy link
Contributor

bors commented Aug 16, 2023

⌛ Testing commit 5b2524e with merge f3b4c67...

@bors
Copy link
Contributor

bors commented Aug 17, 2023

☀️ Test successful - checks-actions
Approved by: tmiasko
Pushing f3b4c67 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 17, 2023
@bors bors merged commit f3b4c67 into rust-lang:master Aug 17, 2023
12 checks passed
@rustbot rustbot added this to the 1.73.0 milestone Aug 17, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f3b4c67): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

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

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.6% [0.6%, 0.6%] 1
Improvements ✅
(primary)
-0.8% [-1.3%, -0.3%] 27
Improvements ✅
(secondary)
-0.7% [-1.1%, -0.4%] 32
All ❌✅ (primary) -0.8% [-1.3%, -0.3%] 27

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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-2.7%, -2.5%] 2
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.

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

Binary size

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

Bootstrap: 635.21s -> 632.126s (-0.49%)
Artifact size: 346.72 MiB -> 346.51 MiB (-0.06%)

@cjgillot cjgillot deleted the elaborate-drops branch August 18, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

8 participants