1
Fork 0

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
This commit is contained in:
Matthias Krüger 2024-07-01 08:53:06 +02:00 committed by GitHub
commit 6938b4b640
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 132 additions and 5 deletions

View file

@ -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;
}
}