Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check type of constant
  • Loading branch information
EgorBo committed Nov 29, 2022
commit eafee93efdf6226c353f8a01f0c8395d6d3e4972
19 changes: 11 additions & 8 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8514,18 +8514,21 @@ static bool GetStaticFieldSeqAndAddress(ValueNumStore* vnStore, GenTree* tree, s
// Accumulate final offset
while (tree->OperIs(GT_ADD))
{
GenTree* op1 = tree->gtGetOp1();
GenTree* op2 = tree->gtGetOp2();
if (!op1->IsIconHandle(GTF_ICON_STATIC_HDL) && op1->gtVNPair.BothEqual() &&
vnStore->IsVNConstant(op1->gtVNPair.GetLiberal()))
GenTree* op1 = tree->gtGetOp1();
GenTree* op2 = tree->gtGetOp2();
ValueNum op1vn = op1->gtVNPair.GetLiberal();
ValueNum op2vn = op2->gtVNPair.GetLiberal();

if (!op1->IsIconHandle(GTF_ICON_STATIC_HDL) && op1->gtVNPair.BothEqual() && vnStore->IsVNConstant(op1vn) &&
varTypeIsIntegral(vnStore->TypeOfVN(op1vn)))
{
val += vnStore->CoercedConstantValue<ssize_t>(op1->gtVNPair.GetLiberal());
val += vnStore->CoercedConstantValue<ssize_t>(op1vn);
tree = op2;
}
else if (!op2->IsIconHandle(GTF_ICON_STATIC_HDL) && op2->gtVNPair.BothEqual() &&
vnStore->IsVNConstant(op2->gtVNPair.GetLiberal()))
else if (!op2->IsIconHandle(GTF_ICON_STATIC_HDL) && op2->gtVNPair.BothEqual() && vnStore->IsVNConstant(op2vn) &&
varTypeIsIntegral(vnStore->TypeOfVN(op2vn)))
{
val += vnStore->CoercedConstantValue<ssize_t>(op2->gtVNPair.GetLiberal());
val += vnStore->CoercedConstantValue<ssize_t>(op2vn);
tree = op1;
}
else
Expand Down