-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix change detection in CfgSimplifier::collapse_goto_chain #75076
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
Conversation
Check that the old target is different from the new collapsed one, before concluding that anything changed.
r? @lcnr (rust_highfive has picked a reviewer for you, use r? to override) |
r? @oli-obk |
@@ -212,6 +210,7 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> { | |||
Terminator { kind: TerminatorKind::Goto { ref mut target }, .. } => target, | |||
_ => unreachable!(), | |||
}; | |||
*changed |= *target != last; |
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.
cc @ecstatic-morse We now have a test case for this!
@@ -0,0 +1,7 @@ | |||
// Caused an infinite loop during SimlifyCfg MIR transform previously. | |||
// | |||
// build-pass |
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.
does this really test this mir pass? don't you also need -Zmir-opt-level=2
?
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.
For this test case no additional flags are necessary to reproduce the issue. Unlike the one from #75051 which also needed -Zmir-opt-level=2
.
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.
ah, superb! thanks
@bors r+ |
📌 Commit 7f9f2ff has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Check that the old target is different from the new collapsed one, before concluding that anything changed.
Fixes #75074
Fixes #75051