summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2020-02-13 14:27:22 -0800
committerHyungju Lee <leee.lee@samsung.com>2020-10-30 18:21:49 +0900
commit5700c9b189b25a7c68936bde8d11b45e17d95f83 (patch)
tree3b586a2cac6a409734026782cfe3a48d9e4f1bb9 /src
parentb21691713af4721fdde0aba7e9848b901605f029 (diff)
downloadcoreclr-5700c9b189b25a7c68936bde8d11b45e17d95f83.tar.gz
coreclr-5700c9b189b25a7c68936bde8d11b45e17d95f83.tar.bz2
coreclr-5700c9b189b25a7c68936bde8d11b45e17d95f83.zip
Port PR #258 to 3.1 (#27984)
* Port PR #258 to 3.1 * Fix test proj file
Diffstat (limited to 'src')
-rw-r--r--src/jit/gentree.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index c635c327c5..6de4f36bf2 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -15741,16 +15741,21 @@ unsigned GenTree::IsLclVarUpdateTree(GenTree** pOtherTree, genTreeOps* pOper)
if (OperIs(GT_ASG))
{
GenTree* lhs = gtOp.gtOp1;
- if (lhs->OperGet() == GT_LCL_VAR)
+ GenTree* rhs = AsOp()->gtOp2;
+ if ((lhs->OperGet() == GT_LCL_VAR) && rhs->OperIsBinary())
{
unsigned lhsLclNum = lhs->AsLclVarCommon()->gtLclNum;
- GenTree* rhs = gtOp.gtOp2;
- if (rhs->OperIsBinary() && (rhs->gtOp.gtOp1->gtOper == GT_LCL_VAR) &&
- (rhs->gtOp.gtOp1->AsLclVarCommon()->gtLclNum == lhsLclNum))
+ GenTree* rhsOp1 = rhs->AsOp()->gtOp1;
+ GenTree* rhsOp2 = rhs->AsOp()->gtOp2;
+
+ // Some operators, such as HWINTRINSIC, are currently declared as binary but
+ // may not have two operands. We must check that both operands actually exist.
+ if ((rhsOp1 != nullptr) && (rhsOp2 != nullptr) && (rhsOp1->OperGet() == GT_LCL_VAR) &&
+ (rhsOp1->AsLclVarCommon()->GetLclNum() == lhsLclNum))
{
lclNum = lhsLclNum;
- *pOtherTree = rhs->gtOp.gtOp2;
- *pOper = rhs->gtOper;
+ *pOtherTree = rhsOp2;
+ *pOper = rhs->OperGet();
}
}
}