From e1044b877b6adefcd3a1b085799a1d8ae825569f Mon Sep 17 00:00:00 2001 From: SingleAccretion Date: Sun, 12 Dec 2021 17:08:01 +0300 Subject: [PATCH] Remove small casts on the RHS of ASG(CLS_VAR) --- src/coreclr/jit/morph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 288f7c16f4d9b6..82b55331a41dd7 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -12024,7 +12024,7 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac) 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())