Skip to content

mir-opt: a sub-BB of a cleanup BB must also be a cleanup BB in EarlyOtherwiseBranch #130786

New issue

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

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

Already on GitHub? # to your account

Merged
merged 4 commits into from
Dec 18, 2024

Conversation

dianqk
Copy link
Member

@dianqk dianqk commented Sep 24, 2024

Fixes #130769.

r? @cjgillot or mir-opt

@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 Sep 24, 2024
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@@ -1337,8 +1337,8 @@ pub struct BasicBlockData<'tcx> {
}

impl<'tcx> BasicBlockData<'tcx> {
pub fn new(terminator: Option<Terminator<'tcx>>) -> BasicBlockData<'tcx> {
BasicBlockData { statements: vec![], terminator, is_cleanup: false }
pub fn new(terminator: Option<Terminator<'tcx>>, is_cleanup: bool) -> BasicBlockData<'tcx> {
Copy link
Member Author

Choose a reason for hiding this comment

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

This should help remind us to set is_cleanup.

fn main() {
opt1(None, Some(0));
opt2(None, Some(0));
opt3(Option2::None, Option2::Some(false));
opt4(Option2::None, Option2::Some(0));
opt5(0, 0);
opt5_failed(0, 0);
Copy link
Member

Choose a reason for hiding this comment

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

Can we also include a version of the reproducer found here as a test case? #130769 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

@dianqk dianqk force-pushed the early_otherwise_branch_cleanup branch from 42f1deb to 2237f02 Compare September 27, 2024 12:30
@dianqk dianqk force-pushed the early_otherwise_branch_cleanup branch from 2237f02 to d98c1d0 Compare October 30, 2024 14:46
@dianqk
Copy link
Member Author

dianqk commented Oct 30, 2024

:) ping?

@dianqk
Copy link
Member Author

dianqk commented Nov 2, 2024

@cjgillot The actual changes in this PR are small, so it should be easy to review. Feel free to re-roll if you like.

@dianqk
Copy link
Member Author

dianqk commented Nov 26, 2024

@cjgillot three week ping :p

targets: eq_targets,
},
}),
bbs[parent].is_cleanup,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just skip trying to optimize parent if it's a cleanup block?

Copy link
Member Author

Choose a reason for hiding this comment

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

Skipping is conservative and fine, but I don't see how optimizing a cleanup BB would be a problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

But optimizing a cleanup BB here has no obvious improvement. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

This previously caused a regression, so I have skipped it.

@dianqk dianqk force-pushed the early_otherwise_branch_cleanup branch from d98c1d0 to 3ba1001 Compare November 27, 2024 00:00
@dianqk
Copy link
Member Author

dianqk commented Dec 17, 2024

Three weeks ping

r? cjgillot
r? oli-obk

@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2024

Could not assign reviewer from: cjgillot.
User(s) cjgillot are either the PR author, already assigned, or on vacation, and there are no other candidates.
Use r? to specify someone else to assign.

@rustbot rustbot assigned oli-obk and unassigned cjgillot Dec 17, 2024
@bors
Copy link
Collaborator

bors commented Dec 17, 2024

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

@oli-obk
Copy link
Contributor

oli-obk commented Dec 18, 2024

r=me

@dianqk dianqk force-pushed the early_otherwise_branch_cleanup branch from 3ba1001 to d08738c Compare December 18, 2024 12:52
@dianqk
Copy link
Member Author

dianqk commented Dec 18, 2024

I have rebased.

@bors r=oli-obk

@bors
Copy link
Collaborator

bors commented Dec 18, 2024

📌 Commit d08738c has been approved by oli-obk

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 Dec 18, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 18, 2024
Rollup of 11 pull requests

Successful merges:

 - rust-lang#130786 ( mir-opt: a sub-BB of a cleanup BB must also be a cleanup BB in `EarlyOtherwiseBranch`)
 - rust-lang#133926 (Fix const conditions for RPITITs)
 - rust-lang#134161 (Overhaul token cursors)
 - rust-lang#134253 (Overhaul keyword handling)
 - rust-lang#134394 (Clarify the match ergonomics 2024 migration lint's output)
 - rust-lang#134399 (Do not do if ! else, use unnegated cond and swap the branches instead)
 - rust-lang#134420 (refactor: replace &PathBuf with &Path to enhance generality)
 - rust-lang#134436 (tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore)
 - rust-lang#134444 (Fix `x build --stage 1 std` when using cg_cranelift as the default backend)
 - rust-lang#134452 (fix(LazyCell): documentation of get[_mut] was wrong)
 - rust-lang#134460 (Merge some patterns together)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2d08e94 into rust-lang:master Dec 18, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 18, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 18, 2024
Rollup merge of rust-lang#130786 - DianQK:early_otherwise_branch_cleanup, r=oli-obk

 mir-opt: a sub-BB of a cleanup BB must also be a cleanup BB in `EarlyOtherwiseBranch`

Fixes rust-lang#130769.

r? `@cjgillot` or mir-opt
@dianqk dianqk deleted the early_otherwise_branch_cleanup branch December 18, 2024 22:20
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-mir-opt Area: MIR optimizations 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.

Panic while compiling http-body v0.4.6 with rustc 1.83.0-nightly (7042c269c 2024-09-23)
7 participants