diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-07-01 08:53:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-01 08:53:06 +0200 |
| commit | 6938b4b64059aab458a4fa9585b770d776e04c19 (patch) | |
| tree | 1415be445567e2a5ed962e48155e209a853614e0 /compiler/rustc_mir_transform/src | |
| parent | 04a3969af7c2c8bea18ce53339dbb4802438577c (diff) | |
| parent | f6942112eb44cb292463d457c603016cc16f4bc6 (diff) | |
| download | rust-6938b4b64059aab458a4fa9585b770d776e04c19.tar.gz rust-6938b4b64059aab458a4fa9585b770d776e04c19.zip | |
Rollup merge of #127105 - scottmcm:issue-127089, r=cjgillot
Only update `Eq` operands in GVN if it can update both sides Otherwise the types might not match Fixes #127089 r? mir-opt
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/gvn.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 936a7e2d9de..3dbdeb615cf 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -1074,11 +1074,11 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { { lhs = *lhs_value; rhs = *rhs_value; - if let Some(op) = self.try_as_operand(lhs, location) { - *lhs_operand = op; - } - if let Some(op) = self.try_as_operand(rhs, location) { - *rhs_operand = op; + if let Some(lhs_op) = self.try_as_operand(lhs, location) + && let Some(rhs_op) = self.try_as_operand(rhs, location) + { + *lhs_operand = lhs_op; + *rhs_operand = rhs_op; } } |
