summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Rozenfeld <erozen@microsoft.com>2017-05-19 15:38:04 -0700
committerGitHub <noreply@github.com>2017-05-19 15:38:04 -0700
commitbf55af2f4c6c29832efe5eeb44f75ff3317ac022 (patch)
treefaf196f0931e569a4b6caeae7c68d03289159c75
parente4c36745745c62c4670be709dc6fb7941e0dcf4c (diff)
parent40af4853a24ff6a861d33b9a3ecf4d5bb3a474f7 (diff)
downloadcoreclr-bf55af2f4c6c29832efe5eeb44f75ff3317ac022.tar.gz
coreclr-bf55af2f4c6c29832efe5eeb44f75ff3317ac022.tar.bz2
coreclr-bf55af2f4c6c29832efe5eeb44f75ff3317ac022.zip
Merge pull request #11209 from erozenfeld/MorphCastNarrowing
Add missing opcodes for morph cast narrowing.
-rw-r--r--src/jit/morph.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index a44b0e75e4..284cc3efc7 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -450,14 +450,16 @@ GenTreePtr Compiler::fgMorphCast(GenTreePtr tree)
// For these operations the lower 32 bits of the result only depends
// upon the lower 32 bits of the operands
//
- if ((oper->OperGet() == GT_ADD) || (oper->OperGet() == GT_MUL) || (oper->OperGet() == GT_AND) ||
- (oper->OperGet() == GT_OR) || (oper->OperGet() == GT_XOR))
+ if (oper->OperIs(GT_ADD, GT_SUB, GT_MUL, GT_AND, GT_OR, GT_XOR, GT_NOT, GT_NEG, GT_LSH))
{
DEBUG_DESTROY_NODE(tree);
// Insert narrowing casts for op1 and op2
oper->gtOp.gtOp1 = gtNewCastNode(TYP_INT, oper->gtOp.gtOp1, dstType);
- oper->gtOp.gtOp2 = gtNewCastNode(TYP_INT, oper->gtOp.gtOp2, dstType);
+ if (oper->gtOp.gtOp2 != nullptr)
+ {
+ oper->gtOp.gtOp2 = gtNewCastNode(TYP_INT, oper->gtOp.gtOp2, dstType);
+ }
// Clear the GT_MUL_64RSLT if it is set
if (oper->gtOper == GT_MUL && (oper->gtFlags & GTF_MUL_64RSLT))