Skip to content

Allow StorageDead(s) of the target block could be copied to the branching block #93987

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

Closed
wants to merge 1 commit into from

Conversation

yzwqf
Copy link

@yzwqf yzwqf commented Feb 14, 2022

Just like 'FIXME(simonvandel)' says. However, intellegient mechanism is need if we care about code size.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthewjasper (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Feb 14, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 14, 2022
if !bridge_bb_statement.is_empty() {
let storagedeads = bridge_bb_statement.clone();
body.basic_blocks_mut()[opt.bb_with_goto].statements.extend(storagedeads);
debug!("SUCCESS: extending terminator's basic block with briding basic block.");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
debug!("SUCCESS: extending terminator's basic block with briding basic block.");
debug!("SUCCESS: extending terminator's basic block with bridging basic block.");

@oli-obk
Copy link
Contributor

oli-obk commented Feb 19, 2022

cc @simonvandel

@oli-obk oli-obk added the A-mir-opt Area: MIR optimizations label Feb 19, 2022
Copy link
Contributor

@simonvandel simonvandel left a comment

Choose a reason for hiding this comment

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

Change looks OK to me.

Comment on lines +47 to +50
let bridge_bb_statement = &body.basic_blocks()[opt.bridge_bb].statements;
if !bridge_bb_statement.is_empty() {
let storagedeads = bridge_bb_statement.clone();
body.basic_blocks_mut()[opt.bb_with_goto].statements.extend(storagedeads);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let bridge_bb_statement = &body.basic_blocks()[opt.bridge_bb].statements;
if !bridge_bb_statement.is_empty() {
let storagedeads = bridge_bb_statement.clone();
body.basic_blocks_mut()[opt.bb_with_goto].statements.extend(storagedeads);
let bridge_bb_statements = &body.basic_blocks()[opt.bridge_bb].statements;
if !bridge_bb_statements.is_empty() {
let storagedeads = bridge_bb_statements.into_iter().cloned();
body.basic_blocks_mut()[opt.bb_with_goto].statements.extend(storagedeads);

@@ -11,6 +11,24 @@ pub enum Foo {
fn issue_77355_opt(num: Foo) -> u64 {
if matches!(num, Foo::B | Foo::C) { 23 } else { 42 }
}

// EMIT_MIR const_goto.match_nested_if.MatchBranchSimplification.diff
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// EMIT_MIR const_goto.match_nested_if.MatchBranchSimplification.diff
// EMIT_MIR const_goto.match_nested_if.MatchBranchSimplification.diff
// EMIT_MIR const_goto.match_nested_if.ConstGoto.diff

@cjgillot
Copy link
Contributor

cjgillot commented Mar 9, 2022

Hi @yzwqf. Could you please address unresolved comments?

@cjgillot cjgillot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 10, 2022
@cjgillot cjgillot assigned cjgillot and unassigned matthewjasper Mar 10, 2022
@bors
Copy link
Collaborator

bors commented Apr 6, 2022

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

@JohnCSimon
Copy link
Member

Ping from triage:
@yzwqf
Can you please address the merge conflicts and build failures?

@JohnCSimon
Copy link
Member

@yzwqf
Ping from triage: I'm closing this due to inactivity, Please reopen when you are ready to continue with this.
Note: if you do please open the PR BEFORE you push to it, else you won't be able to reopen - this is a quirk of github.
Thanks for your contribution.

@rustbot label: +S-inactive

@JohnCSimon JohnCSimon closed this May 22, 2022
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label May 22, 2022
@iSwapna
Copy link
Contributor

iSwapna commented Jan 10, 2023

@rustbot claim

@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 2023

Assignment is not allowed on a closed PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.