Skip to content

Commit

Permalink
Ensure that GT_CNS_VEC is handled in LinearScan::isMatchingConstant (#…
Browse files Browse the repository at this point in the history
…70171)

* Ensure that GT_CNS_VEC is handled in LinearScan::isMatchingConstant

* Ensure an Arm64 assert includes GT_CNS_VEC

* Update src/coreclr/jit/codegenarmarch.cpp

Co-authored-by: Egor Bogatov <egorbo@gmail.com>

Co-authored-by: Egor Bogatov <egorbo@gmail.com>
  • Loading branch information
tannergooding and EgorBo authored Jun 3, 2022
1 parent fe2c1ed commit 24f5de4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
if (treeNode->IsReuseRegVal())
{
// For now, this is only used for constant nodes.
assert((treeNode->OperGet() == GT_CNS_INT) || (treeNode->OperGet() == GT_CNS_DBL));
assert(treeNode->OperIs(GT_CNS_INT, GT_CNS_DBL, GT_CNS_VEC));
JITDUMP(" TreeNode is marked ReuseReg\n");
return;
}
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/jit/lsra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2695,6 +2695,7 @@ bool LinearScan::isMatchingConstant(RegRecord* physRegRecord, RefPosition* refPo
}
break;
}

case GT_CNS_DBL:
{
// For floating point constants, the values must be identical, not simply compare
Expand All @@ -2706,6 +2707,12 @@ bool LinearScan::isMatchingConstant(RegRecord* physRegRecord, RefPosition* refPo
}
break;
}

case GT_CNS_VEC:
{
return GenTreeVecCon::Equals(refPosition->treeNode->AsVecCon(), otherTreeNode->AsVecCon());
}

default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/lsraxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ int LinearScan::BuildNode(GenTree* tree)
case GT_CNS_INT:
case GT_CNS_LNG:
case GT_CNS_DBL:
case GT_CNS_VEC:
{
srcCount = 0;
assert(dstCount == 1);
Expand Down

0 comments on commit 24f5de4

Please sign in to comment.