Remove small casts on the RHS of ASG(CLS_VAR) (#62693)
authorSingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Sun, 19 Dec 2021 22:20:57 +0000 (01:20 +0300)
committerGitHub <noreply@github.com>
Sun, 19 Dec 2021 22:20:57 +0000 (23:20 +0100)
src/coreclr/jit/morph.cpp

index 0729d06..2b75e41 100644 (file)
@@ -12029,7 +12029,7 @@ DONE_MORPHING_CHILDREN:
             effectiveOp1 = op1->gtEffectiveVal();
 
             // If we are storing a small type, we might be able to omit a cast.
-            if (effectiveOp1->OperIs(GT_IND) && varTypeIsSmall(effectiveOp1))
+            if (effectiveOp1->OperIs(GT_IND, GT_CLS_VAR) && varTypeIsSmall(effectiveOp1))
             {
                 if (!gtIsActiveCSE_Candidate(op2) && op2->OperIs(GT_CAST) &&
                     varTypeIsIntegral(op2->AsCast()->CastOp()) && !op2->gtOverflow())