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 |
wesleywiser
left a comment
There was a problem hiding this comment.
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.
We should assert or at least debug_assert that targets.len() == targets_and_values.len()
There was a problem hiding this comment.
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