Only update Eq operands in GVN if you can update both sides

Otherwise the types might not match

Fixes 127089
This commit is contained in:
Scott McMurray 2024-06-28 19:05:01 -07:00
parent e9e6e2e444
commit c9f36f8cd7
3 changed files with 80 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;
}
}