-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Conversation
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> { |
There was a problem hiding this comment.
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
.
04d03e2
to
04f61e3
Compare
04f61e3
to
42f1deb
Compare
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); |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added this: https://github.com/rust-lang/rust/pull/130786/files#diff-50c7b6495288a4628220c4cd9bba0ccd732c336f03738681353d6b64dc0cfa79R29-R43. But, I think the current fn unwind
test case is sufficient.
42f1deb
to
2237f02
Compare
2237f02
to
d98c1d0
Compare
:) ping? |
@cjgillot The actual changes in this PR are small, so it should be easy to review. Feel free to re-roll if you like. |
@cjgillot three week ping :p |
targets: eq_targets, | ||
}, | ||
}), | ||
bbs[parent].is_cleanup, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
d98c1d0
to
3ba1001
Compare
Three weeks ping r? cjgillot |
Could not assign reviewer from: |
☔ The latest upstream changes (presumably #134414) made this pull request unmergeable. Please resolve the merge conflicts. |
r=me |
…ch_scalar, r=cjgillot" This reverts commit 16a0266.
3ba1001
to
d08738c
Compare
I have rebased. @bors r=oli-obk |
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
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
Fixes #130769.
r? @cjgillot or mir-opt