Skip to content

Commit

Permalink
Handle float/double for RVA[cns] optimization in fgValueNumberConstLo…
Browse files Browse the repository at this point in the history
…ad (#80661)
  • Loading branch information
EgorBo authored Jan 15, 2023
1 parent 191b98d commit e2e690b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8610,7 +8610,8 @@ bool Compiler::fgValueNumberConstLoad(GenTreeIndir* tree)
//
ssize_t address = 0;
FieldSeq* fieldSeq = nullptr;
if (varTypeIsIntegral(tree) && GetStaticFieldSeqAndAddress(vnStore, tree->gtGetOp1(), &address, &fieldSeq))
if ((varTypeIsIntegral(tree) || varTypeIsFloating(tree)) &&
GetStaticFieldSeqAndAddress(vnStore, tree->gtGetOp1(), &address, &fieldSeq))
{
assert(fieldSeq->GetKind() == FieldSeq::FieldKind::SimpleStaticKnownAddress);
CORINFO_FIELD_HANDLE fieldHandle = fieldSeq->GetFieldHandle();
Expand Down Expand Up @@ -8679,6 +8680,18 @@ bool Compiler::fgValueNumberConstLoad(GenTreeIndir* tree)
tree->gtVNPair.SetBoth(vnStore->VNForLongCon(val));
return true;
}
case TYP_FLOAT:
{
READ_VALUE(float);
tree->gtVNPair.SetBoth(vnStore->VNForFloatCon(val));
return true;
}
case TYP_DOUBLE:
{
READ_VALUE(double);
tree->gtVNPair.SetBoth(vnStore->VNForDoubleCon(val));
return true;
}
default:
break;
}
Expand Down

0 comments on commit e2e690b

Please sign in to comment.