Ifdef out legacy uses of GT_ASG_op (#14384)
authormikedn <onemihaid@hotmail.com>
Thu, 19 Oct 2017 01:34:55 +0000 (04:34 +0300)
committerBruce Forstall <brucefo@microsoft.com>
Thu, 19 Oct 2017 01:34:55 +0000 (18:34 -0700)
* Ifdef out legacy uses of GT_ASG_op

GT_ASG_op nodes are only generated when the legacy backend is used.

* Address feedback

* Cleanup gtOverflow/gtOverflowEx

22 files changed:
src/jit/assertionprop.cpp
src/jit/codegencommon.cpp
src/jit/compiler.cpp
src/jit/compiler.h
src/jit/compiler.hpp
src/jit/decomposelongs.cpp
src/jit/emitarm.cpp
src/jit/flowgraph.cpp
src/jit/gentree.cpp
src/jit/gentree.h
src/jit/gtlist.h
src/jit/instr.cpp
src/jit/jit.h
src/jit/lclvars.cpp
src/jit/liveness.cpp
src/jit/lsraarm.cpp
src/jit/lsraarm64.cpp
src/jit/lsraxarch.cpp
src/jit/morph.cpp
src/jit/optimizer.cpp
src/jit/rangecheck.cpp
src/jit/valuenum.cpp

index ed49e84..712d7c0 100644 (file)
@@ -26,7 +26,7 @@ Compiler::fgWalkResult Compiler::optAddCopiesCallback(GenTreePtr* pTree, fgWalkD
 {
     GenTreePtr tree = *pTree;
 
-    if (tree->OperKind() & GTK_ASGOP)
+    if (tree->OperIsAssignment())
     {
         GenTreePtr op1  = tree->gtOp.gtOp1;
         Compiler*  comp = data->compiler;
@@ -455,7 +455,7 @@ void Compiler::optAddCopies()
             GenTreePtr tree = optAddCopyAsgnNode;
             GenTreePtr op1  = tree->gtOp.gtOp1;
 
-            noway_assert(tree && op1 && (tree->OperKind() & GTK_ASGOP) && (op1->gtOper == GT_LCL_VAR) &&
+            noway_assert(tree && op1 && tree->OperIsAssignment() && (op1->gtOper == GT_LCL_VAR) &&
                          (op1->gtLclVarCommon.gtLclNum == lclNum));
 
             /*  TODO-Review: BB_UNITY_WEIGHT is not the correct block weight */
@@ -4782,7 +4782,9 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Gen
         case GT_RSH:
         case GT_RSZ:
         case GT_NEG:
+#ifdef LEGACY_BACKEND
         case GT_CHS:
+#endif
         case GT_CAST:
         case GT_INTRINSIC:
             break;
index f4ddafa..80550b0 100644 (file)
@@ -2845,7 +2845,11 @@ void CodeGen::genCheckOverflow(GenTreePtr tree)
 
         if (jumpKind == EJ_lo)
         {
-            if ((tree->OperGet() != GT_SUB) && (tree->gtOper != GT_ASG_SUB))
+            if ((tree->OperGet() != GT_SUB)
+#ifdef LEGACY_BACKEND
+                && (tree->gtOper != GT_ASG_SUB)
+#endif
+                    )
             {
                 jumpKind = EJ_hs;
             }
index ee137e3..c249491 100644 (file)
@@ -9218,10 +9218,12 @@ int cTreeKindsIR(Compiler* comp, GenTree* tree)
     {
         chars += printf("[LOGOP]");
     }
+#ifdef LEGACY_BACKEND
     if (kind & GTK_ASGOP)
     {
         chars += printf("[ASGOP]");
     }
+#endif
     if (kind & GTK_COMMUTE)
     {
         chars += printf("[COMMUTE]");
@@ -9794,8 +9796,10 @@ int cTreeFlagsIR(Compiler* comp, GenTree* tree)
             case GT_CAST:
             case GT_ADD:
             case GT_SUB:
+#ifdef LEGACY_BACKEND
             case GT_ASG_ADD:
             case GT_ASG_SUB:
+#endif
                 if (tree->gtFlags & GTF_OVERFLOW)
                 {
                     chars += printf("[OVERFLOW]");
index 55db62d..2753ff0 100644 (file)
@@ -3757,7 +3757,11 @@ public:
 
     bool fgFoldConditional(BasicBlock* block);
 
+#ifdef LEGACY_BACKEND
     void fgMorphStmts(BasicBlock* block, bool* mult, bool* lnot, bool* loadw);
+#else
+    void fgMorphStmts(BasicBlock* block, bool* lnot, bool* loadw);
+#endif
     void fgMorphBlocks();
 
     bool fgMorphBlockStmt(BasicBlock* block, GenTreeStmt* stmt DEBUGARG(const char* msg));
@@ -3796,7 +3800,9 @@ public:
     // lowering that is distributed between fgMorph and the lowering phase of LSRA.
     void fgSimpleLowering();
 
+#ifdef LEGACY_BACKEND
     bool fgShouldCreateAssignOp(GenTreePtr tree, bool* bReverse);
+#endif
 
     GenTreePtr fgInitThisClass();
 
index 4007b4a..ef6e955 100644 (file)
@@ -1611,16 +1611,9 @@ inline bool GenTree::IsVarAddr() const
 
 inline bool GenTree::gtOverflow() const
 {
-#if !defined(_TARGET_64BIT_) && !defined(LEGACY_BACKEND)
-    assert(gtOper == GT_MUL || gtOper == GT_CAST || gtOper == GT_ADD || gtOper == GT_SUB || gtOper == GT_ASG_ADD ||
-           gtOper == GT_ASG_SUB || gtOper == GT_ADD_LO || gtOper == GT_SUB_LO || gtOper == GT_ADD_HI ||
-           gtOper == GT_SUB_HI);
-#else
-    assert(gtOper == GT_MUL || gtOper == GT_CAST || gtOper == GT_ADD || gtOper == GT_SUB || gtOper == GT_ASG_ADD ||
-           gtOper == GT_ASG_SUB);
-#endif
+    assert(OperMayOverflow());
 
-    if (gtFlags & GTF_OVERFLOW)
+    if ((gtFlags & GTF_OVERFLOW) != 0)
     {
         assert(varTypeIsIntegral(TypeGet()));
 
@@ -1634,15 +1627,7 @@ inline bool GenTree::gtOverflow() const
 
 inline bool GenTree::gtOverflowEx() const
 {
-    if (gtOper == GT_MUL || gtOper == GT_CAST || gtOper == GT_ADD || gtOper == GT_SUB ||
-#if !defined(_TARGET_64BIT_) && !defined(LEGACY_BACKEND)
-        gtOper == GT_ADD_HI || gtOper == GT_SUB_HI ||
-#endif
-        gtOper == GT_ASG_ADD || gtOper == GT_ASG_SUB)
-    {
-        return gtOverflow();
-    }
-    return false;
+    return OperMayOverflow() && gtOverflow();
 }
 
 /*
@@ -3767,7 +3752,7 @@ inline void Compiler::LoopDsc::VERIFY_lpIterTree()
 
     assert(lpIterTree);
 
-    assert(lpIterTree->OperKind() & GTK_ASGOP); // +=, -=, etc or = +, = -, etc
+    assert(lpIterTree->OperIsAssignment());
 
     if (lpIterTree->OperGet() == GT_ASG)
     {
index 32c8bf7..6de7ef6 100644 (file)
@@ -1014,7 +1014,7 @@ GenTree* DecomposeLongs::DecomposeArith(LIR::Use& use)
         loResult->gtFlags |= GTF_SET_FLAGS;
         hiResult->gtFlags |= GTF_USE_FLAGS;
 
-        if (loResult->gtOverflow())
+        if ((loResult->gtFlags & GTF_OVERFLOW) != 0)
         {
             hiResult->gtFlags |= GTF_OVERFLOW | GTF_EXCEPT;
             loResult->gtFlags &= ~(GTF_OVERFLOW | GTF_EXCEPT);
index c21f7ae..c65d799 100644 (file)
@@ -7889,7 +7889,11 @@ regNumber emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst,
             jumpKind                = isUnsignedOverflow ? EJ_lo : EJ_vs;
             if (jumpKind == EJ_lo)
             {
-                if ((dst->OperGet() != GT_SUB) && (dst->OperGet() != GT_ASG_SUB) && (dst->OperGet() != GT_SUB_HI))
+                if ((dst->OperGet() != GT_SUB) &&
+#ifdef LEGACY_BACKEND
+                    (dst->OperGet() != GT_ASG_SUB) &&
+#endif
+                    (dst->OperGet() != GT_SUB_HI))
                 {
                     jumpKind = EJ_hs;
                 }
index 69c8326..e5247ae 100644 (file)
@@ -21079,10 +21079,10 @@ void Compiler::fgDebugCheckFlags(GenTreePtr tree)
 {
     noway_assert(tree->gtOper != GT_STMT);
 
-    genTreeOps oper      = tree->OperGet();
-    unsigned   kind      = tree->OperKind();
-    unsigned   treeFlags = tree->gtFlags & GTF_ALL_EFFECT;
-    unsigned   chkFlags  = 0;
+    const genTreeOps oper      = tree->OperGet();
+    const unsigned   kind      = tree->OperKind();
+    unsigned         treeFlags = tree->gtFlags & GTF_ALL_EFFECT;
+    unsigned         chkFlags  = 0;
 
     if (tree->OperMayThrow(this))
     {
@@ -21224,7 +21224,7 @@ void Compiler::fgDebugCheckFlags(GenTreePtr tree)
 
             /* For a GT_ASG(GT_IND(x), y) we are interested in the side effects of x */
             GenTreePtr op1p;
-            if ((kind & GTK_ASGOP) && (op1->gtOper == GT_IND))
+            if (GenTree::OperIsAssignment(oper) && (op1->gtOper == GT_IND))
             {
                 op1p = op1->gtOp.gtOp1;
             }
@@ -23553,8 +23553,10 @@ Compiler::fgWalkResult Compiler::fgChkThrowCB(GenTreePtr* pTree, fgWalkData* dat
         case GT_MUL:
         case GT_ADD:
         case GT_SUB:
+#ifdef LEGACY_BACKEND
         case GT_ASG_ADD:
         case GT_ASG_SUB:
+#endif
         case GT_CAST:
             if (tree->gtOverflow())
             {
index 23d7302..457ed0f 100644 (file)
@@ -25,6 +25,7 @@ const unsigned short GenTree::gtOperKindTable[] = {
 #include "gtlist.h"
 };
 
+#ifdef LEGACY_BACKEND
 /*****************************************************************************/
 // static
 genTreeOps GenTree::OpAsgToOper(genTreeOps op)
@@ -69,6 +70,7 @@ genTreeOps GenTree::OpAsgToOper(genTreeOps op)
             unreached(); // Precondition implies we don't get here.
     }
 }
+#endif // LEGACY_BACKEND
 
 /*****************************************************************************
  *
@@ -1611,7 +1613,7 @@ AGAIN:
                 return false;
             }
 
-            if (kind & GTK_ASGOP)
+            if (GenTree::OperIsAssignment(oper))
             {
                 // 'tree' is the gtOp1 of an assignment node. So we can handle
                 // the case where defOnly is either true or false.
@@ -3071,8 +3073,8 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
 
     /* Figure out what kind of a node we have */
 
-    genTreeOps oper = tree->OperGet();
-    unsigned   kind = tree->OperKind();
+    const genTreeOps oper = tree->OperGet();
+    const unsigned   kind = tree->OperKind();
 
     /* Assume no fixed registers will be trashed */
 
@@ -4074,9 +4076,10 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
 
             case GT_ADD:
             case GT_SUB:
+#ifdef LEGACY_BACKEND
             case GT_ASG_ADD:
             case GT_ASG_SUB:
-
+#endif
                 if (isflt)
                 {
                     /* FP instructions are a bit more expensive */
@@ -4141,7 +4144,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
 
         /* Assignments need a bit of special handling */
 
-        if (kind & GTK_ASGOP)
+        if (GenTree::OperIsAssignment(oper))
         {
             /* Process the target */
 
@@ -4225,7 +4228,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
 #endif // FEATURE_STACK_FP_X87
 
         bool bReverseInAssignment = false;
-        if (kind & GTK_ASGOP)
+        if (GenTree::OperIsAssignment(oper))
         {
             GenTreePtr op1Val = op1;
 
@@ -4324,10 +4327,11 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
             case GT_RSZ:
             case GT_ROL:
             case GT_ROR:
+#ifdef LEGACY_BACKEND
             case GT_ASG_LSH:
             case GT_ASG_RSH:
             case GT_ASG_RSZ:
-
+#endif
                 /* Variable sized shifts are more expensive and use REG_SHIFT */
 
                 if (!op2->IsCnsIntOrI())
@@ -5831,7 +5835,7 @@ GenTreePtr GenTree::gtGetParent(GenTreePtr** parentChildPtrPtr) const
 
 bool GenTree::OperRequiresAsgFlag()
 {
-    return ((OperKind() & GTK_ASGOP) || (gtOper == GT_XADD) || (gtOper == GT_XCHG) || (gtOper == GT_LOCKADD) ||
+    return (OperIsAssignment() || (gtOper == GT_XADD) || (gtOper == GT_XCHG) || (gtOper == GT_LOCKADD) ||
             (gtOper == GT_CMPXCHG) || (gtOper == GT_MEMORYBARRIER));
 }
 
@@ -12814,7 +12818,9 @@ GenTreePtr Compiler::gtFoldExprSpecial(GenTreePtr tree)
             break;
 
         case GT_ADD:
+#ifdef LEGACY_BACKEND
         case GT_ASG_ADD:
+#endif
             if (val == 0)
             {
                 goto DONE_FOLD;
@@ -12822,7 +12828,9 @@ GenTreePtr Compiler::gtFoldExprSpecial(GenTreePtr tree)
             break;
 
         case GT_MUL:
+#ifdef LEGACY_BACKEND
         case GT_ASG_MUL:
+#endif
             if (val == 1)
             {
                 goto DONE_FOLD;
@@ -12844,7 +12852,9 @@ GenTreePtr Compiler::gtFoldExprSpecial(GenTreePtr tree)
 
         case GT_DIV:
         case GT_UDIV:
+#ifdef LEGACY_BACKEND
         case GT_ASG_DIV:
+#endif
             if ((op2 == cons) && (val == 1) && !(op1->OperKind() & GTK_CONST))
             {
                 goto DONE_FOLD;
@@ -12852,7 +12862,9 @@ GenTreePtr Compiler::gtFoldExprSpecial(GenTreePtr tree)
             break;
 
         case GT_SUB:
+#ifdef LEGACY_BACKEND
         case GT_ASG_SUB:
+#endif
             if ((op2 == cons) && (val == 0) && !(op1->OperKind() & GTK_CONST))
             {
                 goto DONE_FOLD;
@@ -12921,9 +12933,11 @@ GenTreePtr Compiler::gtFoldExprSpecial(GenTreePtr tree)
         case GT_RSZ:
         case GT_ROL:
         case GT_ROR:
+#ifdef LEGACY_BACKEND
         case GT_ASG_LSH:
         case GT_ASG_RSH:
         case GT_ASG_RSZ:
+#endif
             if (val == 0)
             {
                 if (op2 == cons)
@@ -12990,7 +13004,7 @@ DONE_FOLD:
     // a use, update the flags appropriately
     if (op->gtOper == GT_LCL_VAR)
     {
-        assert((tree->OperKind() & GTK_ASGOP) || (op->gtFlags & (GTF_VAR_USEASG | GTF_VAR_DEF)) == 0);
+        assert(tree->OperIsAssignment() || (op->gtFlags & (GTF_VAR_USEASG | GTF_VAR_DEF)) == 0);
 
         op->gtFlags &= ~(GTF_VAR_USEASG | GTF_VAR_DEF);
     }
@@ -13472,7 +13486,9 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)
                         break;
 
                     case GT_NEG:
+#ifdef LEGACY_BACKEND
                     case GT_CHS:
+#endif
                         i1 = -i1;
                         break;
 
@@ -13601,7 +13617,9 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)
                         break;
 
                     case GT_NEG:
+#ifdef LEGACY_BACKEND
                     case GT_CHS:
+#endif
                         lval1 = -lval1;
                         break;
 
@@ -13706,7 +13724,9 @@ GenTreePtr Compiler::gtFoldExprConst(GenTreePtr tree)
                 switch (tree->gtOper)
                 {
                     case GT_NEG:
+#ifdef LEGACY_BACKEND
                     case GT_CHS:
+#endif
                         d1 = -d1;
                         break;
 
@@ -15076,7 +15096,7 @@ bool Compiler::gtNodeHasSideEffects(GenTreePtr tree, unsigned flags)
 {
     if (flags & GTF_ASG)
     {
-        if ((tree->OperKind() & GTK_ASGOP))
+        if (tree->OperIsAssignment())
         {
             return true;
         }
@@ -16157,12 +16177,14 @@ unsigned GenTree::IsLclVarUpdateTree(GenTree** pOtherTree, genTreeOps* pOper)
                     *pOper      = rhs->gtOper;
                 }
             }
+#ifdef LEGACY_BACKEND
             else
             {
                 lclNum      = lhsLclNum;
                 *pOper      = GenTree::OpAsgToOper(gtOper);
                 *pOtherTree = gtOp.gtOp2;
             }
+#endif
         }
     }
     return lclNum;
index 3443634..ed68bf8 100644 (file)
@@ -105,7 +105,9 @@ enum genTreeKinds
     GTK_BINOP = 0x0008, // binary       operator
     GTK_RELOP = 0x0010, // comparison   operator
     GTK_LOGOP = 0x0020, // logical      operator
+#ifdef LEGACY_BACKEND
     GTK_ASGOP = 0x0040, // assignment   operator
+#endif
 
     GTK_KINDMASK = 0x007F, // operator kind mask
 
@@ -1513,7 +1515,11 @@ public:
 
     static bool OperIsAssignment(genTreeOps gtOper)
     {
+#ifdef LEGACY_BACKEND
         return (OperKind(gtOper) & GTK_ASGOP) != 0;
+#else
+        return gtOper == GT_ASG;
+#endif
     }
 
     bool OperIsAssignment() const
@@ -1521,6 +1527,22 @@ public:
         return OperIsAssignment(gtOper);
     }
 
+    static bool OperMayOverflow(genTreeOps gtOper)
+    {
+        return ((gtOper == GT_ADD) || (gtOper == GT_SUB) || (gtOper == GT_MUL) || (gtOper == GT_CAST)
+#ifdef LEGACY_BACKEND
+                || (gtOper == GT_ASG_ADD) || (gtOper == GT_ASG_SUB)
+#elif !defined(_TARGET_64BIT_)
+                || (gtOper == GT_ADD_HI) || (gtOper == GT_SUB_HI)
+#endif
+                    );
+    }
+
+    bool OperMayOverflow() const
+    {
+        return OperMayOverflow(gtOper);
+    }
+
     static bool OperIsIndir(genTreeOps gtOper)
     {
         return gtOper == GT_IND || gtOper == GT_STOREIND || gtOper == GT_NULLCHECK || OperIsBlk(gtOper);
@@ -1651,9 +1673,11 @@ public:
         return OperIsBoundsCheck(OperGet());
     }
 
+#ifdef LEGACY_BACKEND
     // Requires that "op" is an op= operator.  Returns
     // the corresponding "op".
     static genTreeOps OpAsgToOper(genTreeOps op);
+#endif
 
 #ifdef DEBUG
     bool NullOp1Legal() const
@@ -6006,6 +6030,7 @@ inline bool GenTree::RequiresNonNullOp2(genTreeOps oper)
         case GT_ROR:
         case GT_INDEX:
         case GT_ASG:
+#ifdef LEGACY_BACKEND
         case GT_ASG_ADD:
         case GT_ASG_SUB:
         case GT_ASG_MUL:
@@ -6019,6 +6044,7 @@ inline bool GenTree::RequiresNonNullOp2(genTreeOps oper)
         case GT_ASG_LSH:
         case GT_ASG_RSH:
         case GT_ASG_RSZ:
+#endif
         case GT_EQ:
         case GT_NE:
         case GT_LT:
index 26863de..e731b32 100644 (file)
@@ -50,8 +50,10 @@ GTNODE(NEG              , GenTreeOp          ,0,GTK_UNOP)
 GTNODE(COPY             , GenTreeCopyOrReload,0,GTK_UNOP)               // Copies a variable from its current location to a register that satisfies
                                                                         // code generation constraints.  The child is the actual lclVar node.
 GTNODE(RELOAD           , GenTreeCopyOrReload,0,GTK_UNOP)
+#ifdef LEGACY_BACKEND
 GTNODE(CHS              , GenTreeOp          ,0,GTK_BINOP|GTK_ASGOP|GTK_NOTLIR) // GT_CHS is actually unary -- op2 is ignored.
                                                                                 // Changing to unary presently causes problems, though -- take a little work to fix.
+#endif
 
 GTNODE(ARR_LENGTH       , GenTreeArrLen      ,0,GTK_UNOP|GTK_EXOP)      // array-length
 
@@ -128,6 +130,9 @@ GTNODE(MULHI            , GenTreeOp          ,1,GTK_BINOP) // returns high bits
                                                            // the div into a MULHI + some adjustments. In codegen, we only use the
                                                            // results of the high register, and we drop the low results.
 
+#ifndef LEGACY_BACKEND
+GTNODE(ASG              , GenTreeOp          ,0,GTK_BINOP|GTK_NOTLIR)
+#else
 GTNODE(ASG              , GenTreeOp          ,0,GTK_BINOP|GTK_ASGOP|GTK_NOTLIR)
 GTNODE(ASG_ADD          , GenTreeOp          ,0,GTK_BINOP|GTK_ASGOP|GTK_NOTLIR)
 GTNODE(ASG_SUB          , GenTreeOp          ,0,GTK_BINOP|GTK_ASGOP|GTK_NOTLIR)
@@ -144,7 +149,7 @@ GTNODE(ASG_AND          , GenTreeOp          ,0,GTK_BINOP|GTK_ASGOP|GTK_NOTLIR)
 GTNODE(ASG_LSH          , GenTreeOp          ,0,GTK_BINOP|GTK_ASGOP|GTK_NOTLIR)
 GTNODE(ASG_RSH          , GenTreeOp          ,0,GTK_BINOP|GTK_ASGOP|GTK_NOTLIR)
 GTNODE(ASG_RSZ          , GenTreeOp          ,0,GTK_BINOP|GTK_ASGOP|GTK_NOTLIR)
-
+#endif
 GTNODE(EQ               , GenTreeOp          ,0,GTK_BINOP|GTK_RELOP)
 GTNODE(NE               , GenTreeOp          ,0,GTK_BINOP|GTK_RELOP)
 GTNODE(LT               , GenTreeOp          ,0,GTK_BINOP|GTK_RELOP)
index ccad416..c5040ea 100644 (file)
@@ -3585,19 +3585,24 @@ instruction CodeGen::ins_MathOp(genTreeOps oper, var_types type)
     switch (oper)
     {
         case GT_ADD:
+#ifdef LEGACY_BACKEND
         case GT_ASG_ADD:
+#endif
             return type == TYP_DOUBLE ? INS_addsd : INS_addss;
-            break;
         case GT_SUB:
+#ifdef LEGACY_BACKEND
         case GT_ASG_SUB:
+#endif
             return type == TYP_DOUBLE ? INS_subsd : INS_subss;
-            break;
         case GT_MUL:
+#ifdef LEGACY_BACKEND
         case GT_ASG_MUL:
+#endif
             return type == TYP_DOUBLE ? INS_mulsd : INS_mulss;
-            break;
         case GT_DIV:
+#ifdef LEGACY_BACKEND
         case GT_ASG_DIV:
+#endif
             return type == TYP_DOUBLE ? INS_divsd : INS_divss;
         case GT_AND:
             return type == TYP_DOUBLE ? INS_andpd : INS_andps;
@@ -3759,19 +3764,25 @@ instruction CodeGen::ins_MathOp(genTreeOps oper, var_types type)
     switch (oper)
     {
         case GT_ADD:
+#ifdef LEGACY_BACKEND
         case GT_ASG_ADD:
+#endif
             return INS_vadd;
-            break;
         case GT_SUB:
+#ifdef LEGACY_BACKEND
         case GT_ASG_SUB:
+#endif
             return INS_vsub;
-            break;
         case GT_MUL:
+#ifdef LEGACY_BACKEND
         case GT_ASG_MUL:
+#endif
             return INS_vmul;
             break;
         case GT_DIV:
+#ifdef LEGACY_BACKEND
         case GT_ASG_DIV:
+#endif
             return INS_vdiv;
         case GT_NEG:
             return INS_vneg;
index 40533c0..140d263 100644 (file)
@@ -414,8 +414,7 @@ typedef ptrdiff_t ssize_t;
 
 //=============================================================================
 
-#define OPT_MULT_ADDSUB 1 // optimize consecutive "lclVar += or -= icon"
-#define OPT_BOOL_OPS 1    // optimize boolean operations
+#define OPT_BOOL_OPS 1 // optimize boolean operations
 
 //=============================================================================
 
index e5165ba..e5302ed 100644 (file)
@@ -3610,7 +3610,7 @@ void Compiler::lvaMarkLclRefs(GenTreePtr tree)
 
     /* Is this an assigment? */
 
-    if (tree->OperKind() & GTK_ASGOP)
+    if (tree->OperIsAssignment())
     {
         GenTreePtr op1 = tree->gtOp.gtOp1;
         GenTreePtr op2 = tree->gtOp.gtOp2;
@@ -3622,6 +3622,7 @@ void Compiler::lvaMarkLclRefs(GenTreePtr tree)
             unsigned   lclNum;
             LclVarDsc* varDsc = nullptr;
 
+#ifdef LEGACY_BACKEND
             /* GT_CHS is special it doesn't have a valid op2 */
             if (tree->gtOper == GT_CHS)
             {
@@ -3633,6 +3634,7 @@ void Compiler::lvaMarkLclRefs(GenTreePtr tree)
                 }
             }
             else
+#endif
             {
                 if (op2->gtOper == GT_LCL_VAR)
                 {
index 90aa0d1..028fdc9 100644 (file)
@@ -2694,6 +2694,9 @@ bool Compiler::fgRemoveDeadStore(GenTree**        pTree,
         noway_assert(rhsNode);
         noway_assert(tree->gtFlags & GTF_VAR_DEF);
 
+#ifndef LEGACY_BACKEND
+        assert(asgNode->OperIs(GT_ASG));
+#else
         if (asgNode->gtOper != GT_ASG && asgNode->gtOverflowEx())
         {
             // asgNode may be <op_ovf>= (with GTF_OVERFLOW). In that case, we need to keep the <op_ovf>
@@ -2761,7 +2764,7 @@ bool Compiler::fgRemoveDeadStore(GenTree**        pTree,
             }
             return false;
         }
-
+#endif
         // Do not remove if this local variable represents
         // a promoted struct field of an address exposed local.
         if (varDsc->lvIsStructField && lvaTable[varDsc->lvParentLcl].lvAddrExposed)
index 83b150b..46df966 100644 (file)
@@ -375,8 +375,6 @@ void LinearScan::TreeNodeInfoInit(GenTree* tree)
             break;
 
         case GT_ASG:
-        case GT_ASG_ADD:
-        case GT_ASG_SUB:
             noway_assert(!"We should never hit any assignment operator in lowering");
             info->srcCount = 0;
             break;
index 960b748..667d950 100644 (file)
@@ -209,8 +209,6 @@ void LinearScan::TreeNodeInfoInit(GenTree* tree)
             break;
 
         case GT_ASG:
-        case GT_ASG_ADD:
-        case GT_ASG_SUB:
             noway_assert(!"We should never hit any assignment operator in lowering");
             info->srcCount = 0;
             break;
index 4d5c1f7..53aebe0 100644 (file)
@@ -309,8 +309,6 @@ void LinearScan::TreeNodeInfoInit(GenTree* tree)
             break;
 
         case GT_ASG:
-        case GT_ASG_ADD:
-        case GT_ASG_SUB:
             noway_assert(!"We should never hit any assignment operator in lowering");
             info->srcCount = 0;
             break;
index ad4080d..f525330 100644 (file)
@@ -11506,6 +11506,7 @@ GenTreePtr Compiler::fgMorphSmpOp(GenTreePtr tree, MorphAddrContext* mac)
             }
 #endif
 
+#ifdef LEGACY_BACKEND
             __fallthrough;
 
         case GT_ASG_ADD:
@@ -11522,6 +11523,7 @@ GenTreePtr Compiler::fgMorphSmpOp(GenTreePtr tree, MorphAddrContext* mac)
         case GT_ASG_RSH:
         case GT_ASG_RSZ:
         case GT_CHS:
+#endif
 
             // We can't CSE the LHS of an assignment. Only r-values can be CSEed.
             // Previously, the "lhs" (addr) of a block op was CSE'd.  So, to duplicate the former
@@ -12529,6 +12531,7 @@ DONE_MORPHING_CHILDREN:
             }
             fgAssignSetVarDef(tree);
 
+#ifdef LEGACY_BACKEND
             __fallthrough;
 
         case GT_ASG_ADD:
@@ -12544,6 +12547,7 @@ DONE_MORPHING_CHILDREN:
         case GT_ASG_LSH:
         case GT_ASG_RSH:
         case GT_ASG_RSZ:
+#endif
 
             /* We can't CSE the LHS of an assignment */
             /* We also must set in the pre-morphing phase, otherwise assertionProp doesn't see it */
@@ -13543,7 +13547,9 @@ DONE_MORPHING_CHILDREN:
 
             break;
 
+#ifdef LEGACY_BACKEND
         case GT_CHS:
+#endif
         case GT_NOT:
         case GT_NEG:
 
@@ -14028,8 +14034,7 @@ DONE_MORPHING_CHILDREN:
         case GT_COMMA:
 
             /* Special case: trees that don't produce a value */
-            if ((op2->OperKind() & GTK_ASGOP) || (op2->OperGet() == GT_COMMA && op2->TypeGet() == TYP_VOID) ||
-                fgIsThrow(op2))
+            if (op2->OperIsAssignment() || (op2->OperGet() == GT_COMMA && op2->TypeGet() == TYP_VOID) || fgIsThrow(op2))
             {
                 typ = tree->gtType = TYP_VOID;
             }
@@ -14383,19 +14388,12 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree)
 
     switch (oper)
     {
+#ifdef LEGACY_BACKEND
         genTreeOps cmop;
         bool       dstIsSafeLclVar;
+#endif
 
         case GT_ASG:
-            /* We'll convert "a = a <op> x" into "a <op>= x"                     */
-            /*     and also  "a = x <op> a" into "a <op>= x" for communative ops */
-            CLANG_FORMAT_COMMENT_ANCHOR;
-
-            if (typ == TYP_LONG)
-            {
-                break;
-            }
-
             if (varTypeIsStruct(typ) && !tree->IsPhiDefn())
             {
                 if (tree->OperIsCopyBlkOp())
@@ -14408,6 +14406,11 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree)
                 }
             }
 
+            if (typ == TYP_LONG)
+            {
+                break;
+            }
+
             /* Make sure we're allowed to do this */
 
             if (optValnumCSE_phase)
@@ -14416,6 +14419,10 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree)
                 break;
             }
 
+#ifdef LEGACY_BACKEND
+            /* We'll convert "a = a <op> x" into "a <op>= x"                     */
+            /*     and also  "a = x <op> a" into "a <op>= x" for communative ops */
+
             /* Are we assigning to a GT_LCL_VAR ? */
 
             dstIsSafeLclVar = (op1->gtOper == GT_LCL_VAR);
@@ -14440,6 +14447,7 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree)
             }
 
             if (!dstIsSafeLclVar)
+#endif // LEGACY_BACKEND
             {
                 if (op2->gtFlags & GTF_ASG)
                 {
@@ -14454,6 +14462,11 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree)
 
             /* Special case: a cast that can be thrown away */
 
+            // TODO-Cleanup: fgMorphSmp does a similar optimization. However, it removes only
+            // one cast and sometimes there is another one after it that gets removed by this
+            // code. fgMorphSmp should be improved to remove all redundant casts so this code
+            // can be removed.
+
             if (op1->gtOper == GT_IND && op2->gtOper == GT_CAST && !op2->gtOverflow())
             {
                 var_types srct;
@@ -14472,6 +14485,7 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree)
                 }
             }
 
+#ifdef LEGACY_BACKEND
             /* Make sure we have the operator range right */
 
             static_assert(GT_SUB == GT_ADD + 1, "bad oper value");
@@ -14728,7 +14742,7 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree)
                 default:
                     break;
             }
-
+#endif // LEGACY_BACKEND
             break;
 
         case GT_MUL:
@@ -16349,7 +16363,11 @@ bool Compiler::fgMorphBlockStmt(BasicBlock* block, GenTreeStmt* stmt DEBUGARG(co
  *  for reentrant calls.
  */
 
+#ifdef LEGACY_BACKEND
 void Compiler::fgMorphStmts(BasicBlock* block, bool* mult, bool* lnot, bool* loadw)
+#else
+void Compiler::fgMorphStmts(BasicBlock* block, bool* lnot, bool* loadw)
+#endif
 {
     fgRemoveRestOfBlock = false;
 
@@ -16357,7 +16375,10 @@ void Compiler::fgMorphStmts(BasicBlock* block, bool* mult, bool* lnot, bool* loa
 
     compCurBB = block;
 
-    *mult = *lnot = *loadw = false;
+    *lnot = *loadw = false;
+#ifdef LEGACY_BACKEND
+    *mult = false;
+#endif
 
     fgCurrentlyInUseArgTemps = hashBv::Create(this);
 
@@ -16526,8 +16547,7 @@ void Compiler::fgMorphStmts(BasicBlock* block, bool* mult, bool* lnot, bool* loa
             continue;
         }
 
-#if OPT_MULT_ADDSUB
-
+#ifdef LEGACY_BACKEND
         /* Note whether we have two or more +=/-= operators in a row */
 
         if (tree->gtOper == GT_ASG_ADD || tree->gtOper == GT_ASG_SUB)
@@ -16538,14 +16558,13 @@ void Compiler::fgMorphStmts(BasicBlock* block, bool* mult, bool* lnot, bool* loa
             }
         }
 
-#endif
-
         /* Note "x = a[i] & icon" followed by "x |= a[i] << 8" */
 
         if (tree->gtOper == GT_ASG_OR && prev && prev->gtOper == GT_ASG)
         {
             *loadw = true;
         }
+#endif // LEGACY_BACKEND
     }
 
     if (fgRemoveRestOfBlock)
@@ -16651,7 +16670,7 @@ void Compiler::fgMorphBlocks()
 
     do
     {
-#if OPT_MULT_ADDSUB
+#ifdef LEGACY_BACKEND
         bool mult = false;
 #endif
 
@@ -16684,10 +16703,11 @@ void Compiler::fgMorphBlocks()
 
         GenTreePtr tree;
 
+#ifndef LEGACY_BACKEND
+        fgMorphStmts(block, &lnot, &loadw);
+#else
         fgMorphStmts(block, &mult, &lnot, &loadw);
 
-#if OPT_MULT_ADDSUB
-
         if (mult && (opts.compFlags & CLFLG_TREETRANS) && !opts.compDbgCode && !opts.MinOpts())
         {
             for (tree = block->bbTreeList; tree; tree = tree->gtNext)
@@ -16846,7 +16866,7 @@ void Compiler::fgMorphBlocks()
             }
         }
 
-#endif
+#endif // LEGACY_BACKEND
 
         /* Are we using a single return block? */
 
@@ -19367,6 +19387,7 @@ bool Compiler::fgNodesMayInterfere(GenTree* write, GenTree* read)
     }
 }
 
+#ifdef LEGACY_BACKEND
 /** This predicate decides whether we will fold a tree with the structure:
  *  x = x <op> y where x could be any arbitrary expression into
  *  x <op>= y.
@@ -19385,10 +19406,7 @@ bool Compiler::fgShouldCreateAssignOp(GenTreePtr tree, bool* bReverse)
 #if CPU_LOAD_STORE_ARCH
     /* In the case of a load/store architecture, there's no gain by doing any of this, we bail. */
     return false;
-#elif !defined(LEGACY_BACKEND)
-    return false;
-#else  // defined(LEGACY_BACKEND)
-
+#else
     GenTreePtr op1  = tree->gtOp.gtOp1;
     GenTreePtr op2  = tree->gtGetOp2();
     genTreeOps cmop = op2->OperGet();
@@ -19453,8 +19471,9 @@ bool Compiler::fgShouldCreateAssignOp(GenTreePtr tree, bool* bReverse)
         }
     }
     return false;
-#endif // defined(LEGACY_BACKEND)
+#endif // !CPU_LOAD_STORE_ARCH
 }
+#endif // LEGACY_BACKEND
 
 #ifdef FEATURE_SIMD
 
index 4aae376..77b201f 100644 (file)
@@ -3173,12 +3173,16 @@ bool Compiler::optComputeLoopRep(int        constInit,
 
             switch (iterOper)
             {
+#ifdef LEGACY_BACKEND
                 case GT_ASG_SUB:
+#endif
                 case GT_SUB:
                     iterInc = -iterInc;
                     __fallthrough;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_ADD:
+#endif
                 case GT_ADD:
                     if (constInitX != constLimitX)
                     {
@@ -3207,15 +3211,17 @@ bool Compiler::optComputeLoopRep(int        constInit,
                     *iterCount = loopCount;
                     return true;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_MUL:
-                case GT_MUL:
                 case GT_ASG_DIV:
-                case GT_DIV:
                 case GT_ASG_RSH:
-                case GT_RSH:
                 case GT_ASG_LSH:
-                case GT_LSH:
                 case GT_ASG_UDIV:
+#endif
+                case GT_MUL:
+                case GT_DIV:
+                case GT_RSH:
+                case GT_LSH:
                 case GT_UDIV:
                     return false;
 
@@ -3227,12 +3233,16 @@ bool Compiler::optComputeLoopRep(int        constInit,
         case GT_LT:
             switch (iterOper)
             {
+#ifdef LEGACY_BACKEND
                 case GT_ASG_SUB:
+#endif
                 case GT_SUB:
                     iterInc = -iterInc;
                     __fallthrough;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_ADD:
+#endif
                 case GT_ADD:
                     if (constInitX < constLimitX)
                     {
@@ -3261,15 +3271,17 @@ bool Compiler::optComputeLoopRep(int        constInit,
                     *iterCount = loopCount;
                     return true;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_MUL:
-                case GT_MUL:
                 case GT_ASG_DIV:
-                case GT_DIV:
                 case GT_ASG_RSH:
-                case GT_RSH:
                 case GT_ASG_LSH:
-                case GT_LSH:
                 case GT_ASG_UDIV:
+#endif
+                case GT_MUL:
+                case GT_DIV:
+                case GT_RSH:
+                case GT_LSH:
                 case GT_UDIV:
                     return false;
 
@@ -3281,12 +3293,16 @@ bool Compiler::optComputeLoopRep(int        constInit,
         case GT_LE:
             switch (iterOper)
             {
+#ifdef LEGACY_BACKEND
                 case GT_ASG_SUB:
+#endif
                 case GT_SUB:
                     iterInc = -iterInc;
                     __fallthrough;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_ADD:
+#endif
                 case GT_ADD:
                     if (constInitX <= constLimitX)
                     {
@@ -3315,15 +3331,17 @@ bool Compiler::optComputeLoopRep(int        constInit,
                     *iterCount = loopCount;
                     return true;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_MUL:
-                case GT_MUL:
                 case GT_ASG_DIV:
-                case GT_DIV:
                 case GT_ASG_RSH:
-                case GT_RSH:
                 case GT_ASG_LSH:
-                case GT_LSH:
                 case GT_ASG_UDIV:
+#endif
+                case GT_MUL:
+                case GT_DIV:
+                case GT_RSH:
+                case GT_LSH:
                 case GT_UDIV:
                     return false;
 
@@ -3335,12 +3353,16 @@ bool Compiler::optComputeLoopRep(int        constInit,
         case GT_GT:
             switch (iterOper)
             {
+#ifdef LEGACY_BACKEND
                 case GT_ASG_SUB:
+#endif
                 case GT_SUB:
                     iterInc = -iterInc;
                     __fallthrough;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_ADD:
+#endif
                 case GT_ADD:
                     if (constInitX > constLimitX)
                     {
@@ -3369,15 +3391,17 @@ bool Compiler::optComputeLoopRep(int        constInit,
                     *iterCount = loopCount;
                     return true;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_MUL:
-                case GT_MUL:
                 case GT_ASG_DIV:
-                case GT_DIV:
                 case GT_ASG_RSH:
-                case GT_RSH:
                 case GT_ASG_LSH:
-                case GT_LSH:
                 case GT_ASG_UDIV:
+#endif
+                case GT_MUL:
+                case GT_DIV:
+                case GT_RSH:
+                case GT_LSH:
                 case GT_UDIV:
                     return false;
 
@@ -3389,12 +3413,16 @@ bool Compiler::optComputeLoopRep(int        constInit,
         case GT_GE:
             switch (iterOper)
             {
+#ifdef LEGACY_BACKEND
                 case GT_ASG_SUB:
+#endif
                 case GT_SUB:
                     iterInc = -iterInc;
                     __fallthrough;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_ADD:
+#endif
                 case GT_ADD:
                     if (constInitX >= constLimitX)
                     {
@@ -3423,15 +3451,17 @@ bool Compiler::optComputeLoopRep(int        constInit,
                     *iterCount = loopCount;
                     return true;
 
+#ifdef LEGACY_BACKEND
                 case GT_ASG_MUL:
-                case GT_MUL:
                 case GT_ASG_DIV:
-                case GT_DIV:
                 case GT_ASG_RSH:
-                case GT_RSH:
                 case GT_ASG_LSH:
-                case GT_LSH:
                 case GT_ASG_UDIV:
+#endif
+                case GT_MUL:
+                case GT_DIV:
+                case GT_RSH:
+                case GT_LSH:
                 case GT_UDIV:
                     return false;
 
@@ -5566,7 +5596,7 @@ bool Compiler::optNarrowTree(GenTreePtr tree, var_types srct, var_types dstt, Va
     oper = tree->OperGet();
     kind = tree->OperKind();
 
-    if (kind & GTK_ASGOP)
+    if (GenTree::OperIsAssignment(oper))
     {
         noway_assert(doit == false);
         return false;
@@ -5906,7 +5936,7 @@ Compiler::fgWalkResult Compiler::optIsVarAssgCB(GenTreePtr* pTree, fgWalkData* d
 {
     GenTreePtr tree = *pTree;
 
-    if (tree->OperKind() & GTK_ASGOP)
+    if (tree->OperIsAssignment())
     {
         GenTreePtr dest     = tree->gtOp.gtOp1;
         genTreeOps destOper = dest->OperGet();
@@ -8082,7 +8112,7 @@ GenTreePtr Compiler::optFindLocalInit(BasicBlock* block,
 
         GenTreePtr tree = stmt->gtStmt.gtStmtExpr;
         // If we encounter an assignment to a local variable,
-        if ((tree->OperKind() & GTK_ASGOP) && tree->gtOp.gtOp1->gtOper == GT_LCL_VAR)
+        if (tree->OperIsAssignment() && tree->gtOp.gtOp1->gtOper == GT_LCL_VAR)
         {
             // And the assigned variable equals the input local,
             if (tree->gtOp.gtOp1->gtLclVarCommon.gtLclNum == LclNum)
@@ -8213,7 +8243,12 @@ bool Compiler::optIdentifyLoopOptInfo(unsigned loopNum, LoopCloneContext* contex
     }
 
     // TODO-CQ: CLONE: Mark increasing or decreasing loops.
-    if ((pLoop->lpIterOper() != GT_ASG_ADD && pLoop->lpIterOper() != GT_ADD) || (pLoop->lpIterConst() != 1))
+    if ((
+#ifdef LEGACY_BACKEND
+            pLoop->lpIterOper() != GT_ASG_ADD &&
+#endif
+            pLoop->lpIterOper() != GT_ADD) ||
+        (pLoop->lpIterConst() != 1))
     {
         JITDUMP("> Loop iteration operator not matching\n");
         return false;
@@ -8226,10 +8261,16 @@ bool Compiler::optIdentifyLoopOptInfo(unsigned loopNum, LoopCloneContext* contex
         return false;
     }
 
-    if (!(((pLoop->lpTestOper() == GT_LT || pLoop->lpTestOper() == GT_LE) &&
-           (pLoop->lpIterOper() == GT_ADD || pLoop->lpIterOper() == GT_ASG_ADD)) ||
-          ((pLoop->lpTestOper() == GT_GT || pLoop->lpTestOper() == GT_GE) &&
-           (pLoop->lpIterOper() == GT_SUB || pLoop->lpIterOper() == GT_ASG_SUB))))
+    if (!(((pLoop->lpTestOper() == GT_LT || pLoop->lpTestOper() == GT_LE) && (pLoop->lpIterOper() == GT_ADD
+#ifdef LEGACY_BACKEND
+                                                                              || pLoop->lpIterOper() == GT_ASG_ADD
+#endif
+                                                                              )) ||
+          ((pLoop->lpTestOper() == GT_GT || pLoop->lpTestOper() == GT_GE) && (pLoop->lpIterOper() == GT_SUB
+#ifdef LEGACY_BACKEND
+                                                                              || pLoop->lpIterOper() == GT_ASG_SUB
+#endif
+                                                                              ))))
     {
         JITDUMP("> Loop test (%s) doesn't agree with the direction (%s) of the pLoop->\n",
                 GenTree::OpName(pLoop->lpTestOper()), GenTree::OpName(pLoop->lpIterOper()));
index 8037580..3344be0 100644 (file)
@@ -384,16 +384,21 @@ bool RangeCheck::IsMonotonicallyIncreasing(GenTreePtr expr, SearchPath* path)
             return false;
         }
         GenTreePtr asg = loc->parent;
-        assert(asg->OperKind() & GTK_ASGOP);
+        assert(asg->OperIsAssignment());
         switch (asg->OperGet())
         {
             case GT_ASG:
                 return IsMonotonicallyIncreasing(asg->gtGetOp2(), path);
 
+#ifdef LEGACY_BACKEND
             case GT_ASG_ADD:
                 return IsBinOpMonotonicallyIncreasing(asg->gtGetOp1(), asg->gtGetOp2(), GT_ADD, path);
+#endif
 
             default:
+#ifndef LEGACY_BACKEND
+                unreached();
+#endif
                 // All other 'asg->OperGet()' kinds, return false
                 break;
         }
@@ -857,7 +862,7 @@ Range RangeCheck::ComputeRangeForLocalDef(
     }
 #endif
     GenTreePtr asg = loc->parent;
-    assert(asg->OperKind() & GTK_ASGOP);
+    assert(asg->OperIsAssignment());
     switch (asg->OperGet())
     {
         // If the operator of the definition is assignment, then compute the range of the rhs.
@@ -875,14 +880,19 @@ Range RangeCheck::ComputeRangeForLocalDef(
             return range;
         }
 
+#ifdef LEGACY_BACKEND
         case GT_ASG_ADD:
             // If the operator of the definition is +=, then compute the range of the operands of +.
             // Note that gtGetOp1 will return op1 to be the lhs; in the formulation of ssa, we have
             // a side table for defs and the lhs of a += is considered to be a use for SSA numbering.
             return ComputeRangeForBinOp(loc->block, loc->stmt, asg->gtGetOp1(), asg->gtGetOp2(), GT_ADD, path,
                                         monotonic DEBUGARG(indent));
+#endif
 
         default:
+#ifndef LEGACY_BACKEND
+            unreached();
+#endif
             // All other 'asg->OperGet()' kinds, return Limit::keUnknown
             break;
     }
@@ -1034,17 +1044,22 @@ bool RangeCheck::DoesVarDefOverflow(BasicBlock* block, GenTreePtr stmt, GenTreeP
     }
     // Get the parent node which is an asg.
     GenTreePtr asg = loc->parent;
-    assert(asg->OperKind() & GTK_ASGOP);
+    assert(asg->OperIsAssignment());
     switch (asg->OperGet())
     {
         case GT_ASG:
             return DoesOverflow(loc->block, loc->stmt, asg->gtGetOp2(), path);
 
+#ifdef LEGACY_BACKEND
         case GT_ASG_ADD:
             // For GT_ASG_ADD, op2 is use, op1 is also use since we side table for defs in useasg case.
             return DoesBinOpOverflow(loc->block, loc->stmt, asg->gtGetOp1(), asg->gtGetOp2(), path);
+#endif
 
         default:
+#ifndef LEGACY_BACKEND
+            unreached();
+#endif
             // All other 'asg->OperGet()' kinds, conservatively return true
             break;
     }
@@ -1283,7 +1298,7 @@ void RangeCheck::MapStmtDefs(const Location& loc)
         if (ssaNum != SsaConfig::RESERVED_SSA_NUM)
         {
             // To avoid ind(addr) use asgs
-            if (loc.parent->OperKind() & GTK_ASGOP)
+            if (loc.parent->OperIsAssignment())
             {
                 SetDef(HashCode(lclNum, ssaNum), new (m_pCompiler->getAllocator()) Location(loc));
             }
index 473f0ce..f11430a 100644 (file)
@@ -5908,6 +5908,9 @@ void Compiler::fgValueNumberTree(GenTreePtr tree, bool evalAsgLhsInd)
             }
             else // Must be an "op="
             {
+#ifndef LEGACY_BACKEND
+                unreached();
+#else
                 // If the LHS is an IND, we didn't evaluate it when we visited it previously.
                 // But we didn't know that the parent was an op=.  We do now, so go back and evaluate it.
                 // (We actually check if the effective val is the IND.  We will have evaluated any non-last
@@ -5951,6 +5954,7 @@ void Compiler::fgValueNumberTree(GenTreePtr tree, bool evalAsgLhsInd)
                                                                            lhsNormVNP),
                                                     lhsExcVNP);
                 }
+#endif // !LEGACY_BACKEND
             }
             if (tree->TypeGet() != TYP_VOID)
             {