-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix #76803 miscompilation #76844
Fix #76803 miscompilation #76844
Conversation
☔ The latest upstream changes (presumably #76837) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
Check that the variant index matches the target value from the SwitchInt we came from
2fcea07
to
738ed9b
Compare
Rebased |
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.
Looks good to me other than that one small comment.
TerminatorKind::SwitchInt { targets, discr, .. } => (discr, targets), | ||
let (discr_switched_on, targets_and_values):(_, Vec<_>) = match &bb.terminator().kind { | ||
TerminatorKind::SwitchInt { targets, discr, values, .. } => { | ||
// if values.len() == targets.len() - 1, we need to include None where no value is present |
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.
We should assert
or at least debug_assert
that targets.len() == targets_and_values.len()
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.
Added in latest commit
Hi @wesleywiser |
Thanks @simonvandel, sorry for the delay! @bors r+ rollup=never |
📌 Commit a875c7a has been approved by |
⌛ Testing commit a875c7a with merge 326c728a6df1d37e97f9c5bbccff5925a8113838... |
💥 Test timed out |
@bors retry |
☀️ Test successful - checks-actions, checks-azure |
The PR that was |
Fixes #76803
Seems like it was an oversight that the discriminant value being set was not compared to the target value from the SwitchInt, as a comment says this is a requirement for the optimization to be sound.
r? @wesleywiser since you are probably familiar with the optimization and made #76837 to workaround the bug