summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormikedn <onemihaid@hotmail.com>2018-08-26 01:30:57 +0300
committerSergey Andreenko <seandree@microsoft.com>2018-08-25 15:30:57 -0700
commitd27fff3f65193dd71c6197e9876101f496bbd28b (patch)
tree89394985c67adc8a3a08ffa56545f96c07f29dc3 /src
parent9951a1b06f1279fdf8ad465dff355fc38238211f (diff)
downloadcoreclr-d27fff3f65193dd71c6197e9876101f496bbd28b.tar.gz
coreclr-d27fff3f65193dd71c6197e9876101f496bbd28b.tar.bz2
coreclr-d27fff3f65193dd71c6197e9876101f496bbd28b.zip
Remove some GT_ASG_op leftovers (#18205)
Diffstat (limited to 'src')
-rw-r--r--src/jit/assertionprop.cpp4
-rw-r--r--src/jit/compiler.cpp6
-rw-r--r--src/jit/compiler.h8
-rw-r--r--src/jit/compiler.hpp68
-rw-r--r--src/jit/flowgraph.cpp8
-rw-r--r--src/jit/gcinfo.cpp17
-rw-r--r--src/jit/gentree.cpp90
-rw-r--r--src/jit/gentree.h14
-rw-r--r--src/jit/gschecks.cpp2
-rw-r--r--src/jit/jitgcinfo.h2
-rw-r--r--src/jit/lclvars.cpp2
-rw-r--r--src/jit/liveness.cpp4
-rw-r--r--src/jit/lower.cpp7
-rw-r--r--src/jit/lsra.cpp2
-rw-r--r--src/jit/lsraarm.cpp2
-rw-r--r--src/jit/lsraarm64.cpp2
-rw-r--r--src/jit/lsraxarch.cpp2
-rw-r--r--src/jit/morph.cpp4
-rw-r--r--src/jit/optimizer.cpp16
-rw-r--r--src/jit/rangecheck.cpp68
-rw-r--r--src/jit/sideeffects.cpp2
-rw-r--r--src/jit/ssabuilder.cpp8
-rw-r--r--src/jit/treelifeupdater.cpp2
-rw-r--r--src/jit/valuenum.cpp15
24 files changed, 118 insertions, 237 deletions
diff --git a/src/jit/assertionprop.cpp b/src/jit/assertionprop.cpp
index 87cf677b5e..b34e5203ec 100644
--- a/src/jit/assertionprop.cpp
+++ b/src/jit/assertionprop.cpp
@@ -26,7 +26,7 @@ Compiler::fgWalkResult Compiler::optAddCopiesCallback(GenTree** pTree, fgWalkDat
{
GenTree* tree = *pTree;
- if (tree->OperIsAssignment())
+ if (tree->OperIs(GT_ASG))
{
GenTree* op1 = tree->gtOp.gtOp1;
Compiler* comp = data->compiler;
@@ -450,7 +450,7 @@ void Compiler::optAddCopies()
GenTree* tree = optAddCopyAsgnNode;
GenTree* op1 = tree->gtOp.gtOp1;
- noway_assert(tree && op1 && tree->OperIsAssignment() && (op1->gtOper == GT_LCL_VAR) &&
+ noway_assert(tree && op1 && tree->OperIs(GT_ASG) && (op1->gtOper == GT_LCL_VAR) &&
(op1->gtLclVarCommon.gtLclNum == lclNum));
/* TODO-Review: BB_UNITY_WEIGHT is not the correct block weight */
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 39d36ca67e..7eb1ad2062 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -10295,7 +10295,7 @@ int cOperandIR(Compiler* comp, GenTree* operand)
}
chars += cLeafIR(comp, operand);
}
- else if (dumpDataflow && (operand->OperIsAssignment() || (op == GT_STORE_LCL_VAR) || (op == GT_STORE_LCL_FLD)))
+ else if (dumpDataflow && (operand->OperIs(GT_ASG) || (op == GT_STORE_LCL_VAR) || (op == GT_STORE_LCL_FLD)))
{
operand = operand->GetChild(0);
chars += cOperandIR(comp, operand);
@@ -10567,7 +10567,7 @@ void cNodeIR(Compiler* comp, GenTree* tree)
// }
chars += printf(" ");
- if (dataflowView && tree->OperIsAssignment())
+ if (dataflowView && tree->OperIs(GT_ASG))
{
child = tree->GetChild(0);
chars += cOperandIR(comp, child);
@@ -10620,7 +10620,7 @@ void cNodeIR(Compiler* comp, GenTree* tree)
if (dataflowView)
{
- if (tree->OperIsAssignment() || (op == GT_STORE_LCL_VAR) || (op == GT_STORE_LCL_FLD) || (op == GT_STOREIND))
+ if (tree->OperIs(GT_ASG) || (op == GT_STORE_LCL_VAR) || (op == GT_STORE_LCL_FLD) || (op == GT_STOREIND))
{
chars += printf("(t%d)", tree->gtTreeID);
}
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index a7629fcbe7..b15706d875 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -4107,8 +4107,8 @@ public:
void fgInterBlockLocalVarLiveness();
- // The presence of "x op= y" operations presents some difficulties for SSA: this is both a use of some SSA name of
- // "x", and a def of a new SSA name for "x". The tree only has one local variable for "x", so it has to choose
+ // The presence of a partial definition presents some difficulties for SSA: this is both a use of some SSA name
+ // of "x", and a def of a new SSA name for "x". The tree only has one local variable for "x", so it has to choose
// whether to treat that as the use or def. It chooses the "use", and thus the old SSA name. This map allows us
// to record/recover the "def" SSA number, given the lcl var node for "x" in such a tree.
typedef JitHashTable<GenTree*, JitPtrKeyFuncs<GenTree>, unsigned> NodeToUnsignedMap;
@@ -4130,7 +4130,7 @@ public:
// Requires that "lcl" has the GTF_VAR_DEF flag set. Returns the SSA number of "lcl".
// Except: assumes that lcl is a def, and if it is
- // a def appearing in "lcl op= rhs" (GTF_VAR_USEASG), looks up and returns the SSA number for the "def",
+ // a partial def (GTF_VAR_USEASG), looks up and returns the SSA number for the "def",
// rather than the "use" SSA number recorded in the tree "lcl".
inline unsigned GetSsaNumForLocalVarDef(GenTree* lcl);
@@ -5503,7 +5503,7 @@ public:
/* The following values are set only for iterator loops, i.e. has the flag LPFLG_ITER set */
- GenTree* lpIterTree; // The "i <op>= const" tree
+ GenTree* lpIterTree; // The "i = i <op> const" tree
unsigned lpIterVar(); // iterator variable #
int lpIterConst(); // the constant with which the iterator is incremented
genTreeOps lpIterOper(); // the type of the operation on the iterator (ASG_ADD, ASG_SUB, etc.)
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index cdaa04a53d..3b3cea2401 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -3406,38 +3406,28 @@ inline void Compiler::LoopDsc::VERIFY_lpIterTree()
#ifdef DEBUG
assert(lpFlags & LPFLG_ITER);
- // iterTree should be "lcl <op>= const"
+ // iterTree should be "lcl ASG lcl <op> const"
- assert(lpIterTree);
+ assert(lpIterTree->OperIs(GT_ASG));
- assert(lpIterTree->OperIsAssignment());
+ GenTree* lhs = lpIterTree->gtOp.gtOp1;
+ GenTree* rhs = lpIterTree->gtOp.gtOp2;
+ assert(lhs->OperGet() == GT_LCL_VAR);
- if (lpIterTree->OperGet() == GT_ASG)
+ switch (rhs->gtOper)
{
- GenTree* lhs = lpIterTree->gtOp.gtOp1;
- GenTree* rhs = lpIterTree->gtOp.gtOp2;
- assert(lhs->OperGet() == GT_LCL_VAR);
-
- switch (rhs->gtOper)
- {
- case GT_ADD:
- case GT_SUB:
- case GT_MUL:
- case GT_RSH:
- case GT_LSH:
- break;
- default:
- assert(!"Unknown operator for loop increment");
- }
- assert(rhs->gtOp.gtOp1->OperGet() == GT_LCL_VAR);
- assert(rhs->gtOp.gtOp1->AsLclVarCommon()->GetLclNum() == lhs->AsLclVarCommon()->GetLclNum());
- assert(rhs->gtOp.gtOp2->OperGet() == GT_CNS_INT);
- }
- else
- {
- assert(lpIterTree->gtOp.gtOp1->OperGet() == GT_LCL_VAR);
- assert(lpIterTree->gtOp.gtOp2->OperGet() == GT_CNS_INT);
+ case GT_ADD:
+ case GT_SUB:
+ case GT_MUL:
+ case GT_RSH:
+ case GT_LSH:
+ break;
+ default:
+ assert(!"Unknown operator for loop increment");
}
+ assert(rhs->gtOp.gtOp1->OperGet() == GT_LCL_VAR);
+ assert(rhs->gtOp.gtOp1->AsLclVarCommon()->GetLclNum() == lhs->AsLclVarCommon()->GetLclNum());
+ assert(rhs->gtOp.gtOp2->OperGet() == GT_CNS_INT);
#endif
}
@@ -3454,15 +3444,8 @@ inline unsigned Compiler::LoopDsc::lpIterVar()
inline int Compiler::LoopDsc::lpIterConst()
{
VERIFY_lpIterTree();
- if (lpIterTree->OperGet() == GT_ASG)
- {
- GenTree* rhs = lpIterTree->gtOp.gtOp2;
- return (int)rhs->gtOp.gtOp2->gtIntCon.gtIconVal;
- }
- else
- {
- return (int)lpIterTree->gtOp.gtOp2->gtIntCon.gtIconVal;
- }
+ GenTree* rhs = lpIterTree->gtOp.gtOp2;
+ return (int)rhs->gtOp.gtOp2->gtIntCon.gtIconVal;
}
//-----------------------------------------------------------------------------
@@ -3470,15 +3453,8 @@ inline int Compiler::LoopDsc::lpIterConst()
inline genTreeOps Compiler::LoopDsc::lpIterOper()
{
VERIFY_lpIterTree();
- if (lpIterTree->OperGet() == GT_ASG)
- {
- GenTree* rhs = lpIterTree->gtOp.gtOp2;
- return rhs->OperGet();
- }
- else
- {
- return lpIterTree->OperGet();
- }
+ GenTree* rhs = lpIterTree->gtOp.gtOp2;
+ return rhs->OperGet();
}
inline var_types Compiler::LoopDsc::lpIterOperType()
@@ -4301,7 +4277,7 @@ unsigned Compiler::GetSsaNumForLocalVarDef(GenTree* lcl)
if (lcl->gtFlags & GTF_VAR_USEASG)
{
- // It's an "lcl op= rhs" assignment. "lcl" is both used and defined here;
+ // It's partial definition of a struct. "lcl" is both used and defined here;
// we've chosen in this case to annotate "lcl" with the SSA number (and VN) of the use,
// and to store the SSA number of the def in a side table.
unsigned ssaNum;
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index 3bf89bae66..9b361ff46e 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -21159,7 +21159,7 @@ void Compiler::fgDebugCheckFlags(GenTree* tree)
/* For a GT_ASG(GT_IND(x), y) we are interested in the side effects of x */
GenTree* op1p;
- if (GenTree::OperIsAssignment(oper) && (op1->gtOper == GT_IND))
+ if ((oper == GT_ASG) && (op1->gtOper == GT_IND))
{
op1p = op1->gtOp.gtOp1;
}
@@ -25493,7 +25493,7 @@ private:
bool ContainsFatCalli(GenTreeStmt* stmt)
{
GenTree* fatPointerCandidate = stmt->gtStmtExpr;
- if (fatPointerCandidate->OperIsAssignment())
+ if (fatPointerCandidate->OperIs(GT_ASG))
{
fatPointerCandidate = fatPointerCandidate->gtGetOp2();
}
@@ -25510,7 +25510,7 @@ private:
checkBlock = nullptr;
thenBlock = nullptr;
elseBlock = nullptr;
- doesReturnValue = stmt->gtStmtExpr->OperIsAssignment();
+ doesReturnValue = stmt->gtStmtExpr->OperIs(GT_ASG);
origCall = GetCall(stmt);
fptrAddress = origCall->gtCallAddr;
pointerType = fptrAddress->TypeGet();
@@ -25547,7 +25547,7 @@ private:
GenTreeCall* call = nullptr;
if (doesReturnValue)
{
- assert(tree->OperIsAssignment());
+ assert(tree->OperIs(GT_ASG));
call = tree->gtGetOp2()->AsCall();
}
else
diff --git a/src/jit/gcinfo.cpp b/src/jit/gcinfo.cpp
index 0ec4933001..16384e4512 100644
--- a/src/jit/gcinfo.cpp
+++ b/src/jit/gcinfo.cpp
@@ -292,20 +292,11 @@ GCInfo::WriteBarrierForm GCInfo::gcIsWriteBarrierCandidate(GenTree* tgt, GenTree
return WBF_NoBarrier;
}
-bool GCInfo::gcIsWriteBarrierAsgNode(GenTree* op)
+bool GCInfo::gcIsWriteBarrierStoreIndNode(GenTree* op)
{
- if (op->gtOper == GT_ASG)
- {
- return gcIsWriteBarrierCandidate(op->gtOp.gtOp1, op->gtOp.gtOp2) != WBF_NoBarrier;
- }
- else if (op->gtOper == GT_STOREIND)
- {
- return gcIsWriteBarrierCandidate(op, op->gtOp.gtOp2) != WBF_NoBarrier;
- }
- else
- {
- return false;
- }
+ assert(op->OperIs(GT_STOREIND));
+
+ return gcIsWriteBarrierCandidate(op, op->gtOp.gtOp2) != WBF_NoBarrier;
}
/*****************************************************************************/
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index 975cb4d7e7..e8a2f2c520 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -1610,7 +1610,7 @@ AGAIN:
return false;
}
- if (GenTree::OperIsAssignment(oper))
+ if (oper == GT_ASG)
{
// 'tree' is the gtOp1 of an assignment node. So we can handle
// the case where defOnly is either true or false.
@@ -4121,43 +4121,25 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
return gtSetListOrder(tree, isListCallArgs, callArgsInRegs);
}
- default:
- break;
- }
-
- /* Assignments need a bit of special handling */
-
- if (GenTree::OperIsAssignment(oper))
- {
- /* Process the target */
-
- level = gtSetEvalOrder(op1);
+ case GT_ASG:
+ /* Assignments need a bit of special handling */
+ /* Process the target */
+ level = gtSetEvalOrder(op1);
- if (gtIsLikelyRegVar(op1))
- {
- assert(lvlb == 0);
- lvl2 = gtSetEvalOrder(op2);
- if (oper != GT_ASG)
+ if (gtIsLikelyRegVar(op1))
{
- ftreg |= op2->gtRsvdRegs;
- }
+ assert(lvlb == 0);
+ lvl2 = gtSetEvalOrder(op2);
- /* Assignment to an enregistered LCL_VAR */
- costEx = op2->gtCostEx;
- costSz = max(3, op2->gtCostSz); // 3 is an estimate for a reg-reg assignment
- goto DONE_OP1_AFTER_COST;
- }
- else if (oper != GT_ASG)
- {
- // Assign-Op instructions read and write op1
- //
- costEx += op1->gtCostEx;
-#ifdef _TARGET_ARM_
- costSz += op1->gtCostSz;
-#endif
- }
+ /* Assignment to an enregistered LCL_VAR */
+ costEx = op2->gtCostEx;
+ costSz = max(3, op2->gtCostSz); // 3 is an estimate for a reg-reg assignment
+ goto DONE_OP1_AFTER_COST;
+ }
+ goto DONE_OP1;
- goto DONE_OP1;
+ default:
+ break;
}
/* Process the sub-operands */
@@ -4186,18 +4168,15 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
DONE_OP1_AFTER_COST:
bool bReverseInAssignment = false;
- if (GenTree::OperIsAssignment(oper))
+ if (oper == GT_ASG)
{
GenTree* op1Val = op1;
- if (tree->gtOper == GT_ASG)
+ // Skip over the GT_IND/GT_ADDR tree (if one exists)
+ //
+ if ((op1->gtOper == GT_IND) && (op1->gtOp.gtOp1->gtOper == GT_ADDR))
{
- // Skip over the GT_IND/GT_ADDR tree (if one exists)
- //
- if ((op1->gtOper == GT_IND) && (op1->gtOp.gtOp1->gtOper == GT_ADDR))
- {
- op1Val = op1->gtOp.gtOp1->gtOp.gtOp1;
- }
+ op1Val = op1->gtOp.gtOp1->gtOp.gtOp1;
}
switch (op1Val->gtOper)
@@ -5497,7 +5476,7 @@ GenTree* GenTree::gtGetParent(GenTree*** parentChildPtrPtr) const
bool GenTree::OperRequiresAsgFlag()
{
- if (OperIsAssignment() || OperIs(GT_XADD, GT_XCHG, GT_LOCKADD, GT_CMPXCHG, GT_MEMORYBARRIER))
+ if (OperIs(GT_ASG) || OperIs(GT_XADD, GT_XCHG, GT_LOCKADD, GT_CMPXCHG, GT_MEMORYBARRIER))
{
return true;
}
@@ -11884,7 +11863,7 @@ void Compiler::gtDispLIRNode(GenTree* node, const char* prefixMsg /* = nullptr *
displayOperand(operand, "size", operandArc, indentStack, prefixIndent);
}
}
- else if (node->OperIsAssignment())
+ else if (node->OperIs(GT_ASG))
{
if (operand == node->gtGetOp1())
{
@@ -12789,7 +12768,7 @@ DONE_FOLD:
// a use, update the flags appropriately
if (op->gtOper == GT_LCL_VAR)
{
- assert(tree->OperIsAssignment() || (op->gtFlags & (GTF_VAR_USEASG | GTF_VAR_DEF)) == 0);
+ assert(tree->OperIs(GT_ASG) || (op->gtFlags & (GTF_VAR_USEASG | GTF_VAR_DEF)) == 0);
op->gtFlags &= ~(GTF_VAR_USEASG | GTF_VAR_DEF);
}
@@ -14921,7 +14900,7 @@ bool Compiler::gtNodeHasSideEffects(GenTree* tree, unsigned flags)
// will simply be dropped is they are ever subject to an "extract side effects" operation.
// It is possible that the reason no bugs have yet been observed in this area is that the
// other nodes are likely to always be tree roots.
- if (tree->OperIsAssignment())
+ if (tree->OperIs(GT_ASG))
{
return true;
}
@@ -15620,7 +15599,7 @@ bool GenTree::IsPartialLclFld(Compiler* comp)
bool GenTree::DefinesLocal(Compiler* comp, GenTreeLclVarCommon** pLclVarTree, bool* pIsEntire)
{
GenTreeBlk* blkNode = nullptr;
- if (OperIsAssignment())
+ if (OperIs(GT_ASG))
{
if (gtOp.gtOp1->IsLocal())
{
@@ -15934,22 +15913,19 @@ bool GenTree::IsLocalAddrExpr(Compiler* comp, GenTreeLclVarCommon** pLclVarTree,
unsigned GenTree::IsLclVarUpdateTree(GenTree** pOtherTree, genTreeOps* pOper)
{
unsigned lclNum = BAD_VAR_NUM;
- if (OperIsAssignment())
+ if (OperIs(GT_ASG))
{
GenTree* lhs = gtOp.gtOp1;
if (lhs->OperGet() == GT_LCL_VAR)
{
unsigned lhsLclNum = lhs->AsLclVarCommon()->gtLclNum;
- if (gtOper == GT_ASG)
+ GenTree* rhs = gtOp.gtOp2;
+ if (rhs->OperIsBinary() && (rhs->gtOp.gtOp1->gtOper == GT_LCL_VAR) &&
+ (rhs->gtOp.gtOp1->AsLclVarCommon()->gtLclNum == lhsLclNum))
{
- GenTree* rhs = gtOp.gtOp2;
- if (rhs->OperIsBinary() && (rhs->gtOp.gtOp1->gtOper == GT_LCL_VAR) &&
- (rhs->gtOp.gtOp1->AsLclVarCommon()->gtLclNum == lhsLclNum))
- {
- lclNum = lhsLclNum;
- *pOtherTree = rhs->gtOp.gtOp2;
- *pOper = rhs->gtOper;
- }
+ lclNum = lhsLclNum;
+ *pOtherTree = rhs->gtOp.gtOp2;
+ *pOper = rhs->gtOper;
}
}
}
diff --git a/src/jit/gentree.h b/src/jit/gentree.h
index cd402168fa..724bae66cb 100644
--- a/src/jit/gentree.h
+++ b/src/jit/gentree.h
@@ -762,7 +762,9 @@ public:
// GT_LCL_VAR nodes may be changed to GT_REG_VAR nodes without resetting
// the flags. These are also used by GT_LCL_FLD.
#define GTF_VAR_DEF 0x80000000 // GT_LCL_VAR -- this is a definition
-#define GTF_VAR_USEASG 0x40000000 // GT_LCL_VAR -- this is a use/def for a x<op>=y
+#define GTF_VAR_USEASG 0x40000000 // GT_LCL_VAR -- this is a partial definition, a use of the previous definition is implied
+ // A partial definition usually occurs when a struct field is assigned to (s.f = ...) or
+ // when a scalar typed variable is assigned to via a narrow store (*((byte*)&i) = ...).
#define GTF_VAR_CAST 0x10000000 // GT_LCL_VAR -- has been explictly cast (variable node may not be type of local)
#define GTF_VAR_ITERATOR 0x08000000 // GT_LCL_VAR -- this is a iterator reference in the loop condition
#define GTF_VAR_CLONED 0x01000000 // GT_LCL_VAR -- this node has been cloned or is a clone
@@ -1431,16 +1433,6 @@ public:
(OperIsHWIntrinsic(gtOper) && isCommutativeHWIntrinsic());
}
- static bool OperIsAssignment(genTreeOps gtOper)
- {
- return gtOper == GT_ASG;
- }
-
- bool OperIsAssignment() const
- {
- return OperIsAssignment(gtOper);
- }
-
static bool OperMayOverflow(genTreeOps gtOper)
{
return ((gtOper == GT_ADD) || (gtOper == GT_SUB) || (gtOper == GT_MUL) || (gtOper == GT_CAST)
diff --git a/src/jit/gschecks.cpp b/src/jit/gschecks.cpp
index 70dd3130b3..8fe14b9d9d 100644
--- a/src/jit/gschecks.cpp
+++ b/src/jit/gschecks.cpp
@@ -229,7 +229,7 @@ Compiler::fgWalkResult Compiler::gsMarkPtrsAndAssignGroups(GenTree** pTree, fgWa
default:
// Assignments - track assign groups and *p defs.
- if (tree->OperIsAssignment())
+ if (tree->OperIs(GT_ASG))
{
bool isLocVar;
bool isLocFld;
diff --git a/src/jit/jitgcinfo.h b/src/jit/jitgcinfo.h
index dddde20e92..cbbd954e20 100644
--- a/src/jit/jitgcinfo.h
+++ b/src/jit/jitgcinfo.h
@@ -321,7 +321,7 @@ public:
};
WriteBarrierForm gcIsWriteBarrierCandidate(GenTree* tgt, GenTree* assignVal);
- bool gcIsWriteBarrierAsgNode(GenTree* op);
+ bool gcIsWriteBarrierStoreIndNode(GenTree* op);
// Returns a WriteBarrierForm decision based on the form of "tgtAddr", which is assumed to be the
// argument of a GT_IND LHS.
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index d94ad0dbfb..a984f6c6bf 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -3486,7 +3486,7 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, GenTreeStmt* stm
{
/* Is this an assigment? */
- if (tree->OperIsAssignment())
+ if (tree->OperIs(GT_ASG))
{
GenTree* op1 = tree->gtOp.gtOp1;
GenTree* op2 = tree->gtOp.gtOp2;
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp
index 8965898afe..35edbfc261 100644
--- a/src/jit/liveness.cpp
+++ b/src/jit/liveness.cpp
@@ -370,7 +370,7 @@ void Compiler::fgPerNodeLocalVarLiveness(GenTree* tree)
default:
// Determine what memory locations it defines.
- if (tree->OperIsAssignment() || tree->OperIsBlkOp())
+ if (tree->OperIs(GT_ASG) || tree->OperIsBlkOp())
{
GenTreeLclVarCommon* dummyLclVarTree = nullptr;
if (tree->DefinesLocal(this, &dummyLclVarTree))
@@ -2100,7 +2100,7 @@ bool Compiler::fgRemoveDeadStore(GenTree** pTree,
return false;
}
- if (asgNode->OperIsAssignment())
+ if (asgNode->OperIs(GT_ASG))
{
rhsNode = asgNode->gtGetOp2();
}
diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp
index d1aae01561..0d0f4804d2 100644
--- a/src/jit/lower.cpp
+++ b/src/jit/lower.cpp
@@ -111,7 +111,7 @@ GenTree* Lowering::LowerNode(GenTree* node)
case GT_STOREIND:
TryCreateAddrMode(LIR::Use(BlockRange(), &node->gtOp.gtOp1, node), true);
- if (!comp->codeGen->gcInfo.gcIsWriteBarrierAsgNode(node))
+ if (!comp->codeGen->gcInfo.gcIsWriteBarrierStoreIndNode(node))
{
LowerStoreIndir(node->AsIndir());
}
@@ -388,8 +388,7 @@ GenTree* Lowering::LowerNode(GenTree* node)
* the default case of the switch in case the conditional is evaluated to true).
*
* ----- original block, transformed
- * GT_ASG
- * |_____ tempLocal (a new temporary local variable used to store the switch index)
+ * GT_STORE_LCL_VAR tempLocal (a new temporary local variable used to store the switch index)
* |_____ expr (the index expression)
*
* GT_JTRUE
@@ -1273,7 +1272,7 @@ void Lowering::LowerArg(GenTreeCall* call, GenTree** ppArg)
DISPNODE(arg);
// No assignments should remain by Lowering.
- assert(!arg->OperIsAssignment());
+ assert(!arg->OperIs(GT_ASG));
assert(!arg->OperIsPutArgStk());
// Assignments/stores at this level are not really placing an argument.
diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp
index 09d4e17a24..7a86f33310 100644
--- a/src/jit/lsra.cpp
+++ b/src/jit/lsra.cpp
@@ -8854,7 +8854,7 @@ void LinearScan::lsraDispNode(GenTree* tree, LsraTupleDumpMode mode, bool hasDes
printf(" V%02u MEM", varNum);
}
}
- else if (tree->OperIsAssignment())
+ else if (tree->OperIs(GT_ASG))
{
assert(!tree->gtHasReg());
printf(" asg%s ", GenTree::OpName(tree->OperGet()));
diff --git a/src/jit/lsraarm.cpp b/src/jit/lsraarm.cpp
index 8d87794d1f..00496687c6 100644
--- a/src/jit/lsraarm.cpp
+++ b/src/jit/lsraarm.cpp
@@ -727,7 +727,7 @@ int LinearScan::BuildNode(GenTree* tree)
assert(dstCount == 0);
GenTree* src = tree->gtGetOp2();
- if (compiler->codeGen->gcInfo.gcIsWriteBarrierAsgNode(tree))
+ if (compiler->codeGen->gcInfo.gcIsWriteBarrierStoreIndNode(tree))
{
srcCount = BuildGCWriteBarrier(tree);
break;
diff --git a/src/jit/lsraarm64.cpp b/src/jit/lsraarm64.cpp
index e5a6a87ba6..13b45a943e 100644
--- a/src/jit/lsraarm64.cpp
+++ b/src/jit/lsraarm64.cpp
@@ -761,7 +761,7 @@ int LinearScan::BuildNode(GenTree* tree)
{
assert(dstCount == 0);
- if (compiler->codeGen->gcInfo.gcIsWriteBarrierAsgNode(tree))
+ if (compiler->codeGen->gcInfo.gcIsWriteBarrierStoreIndNode(tree))
{
srcCount = BuildGCWriteBarrier(tree);
break;
diff --git a/src/jit/lsraxarch.cpp b/src/jit/lsraxarch.cpp
index 1cb407b2f6..aeb86e54fd 100644
--- a/src/jit/lsraxarch.cpp
+++ b/src/jit/lsraxarch.cpp
@@ -607,7 +607,7 @@ int LinearScan::BuildNode(GenTree* tree)
break;
case GT_STOREIND:
- if (compiler->codeGen->gcInfo.gcIsWriteBarrierAsgNode(tree))
+ if (compiler->codeGen->gcInfo.gcIsWriteBarrierStoreIndNode(tree))
{
srcCount = BuildGCWriteBarrier(tree);
break;
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index dd570d3256..26edaaf06b 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -13682,7 +13682,7 @@ DONE_MORPHING_CHILDREN:
case GT_COMMA:
/* Special case: trees that don't produce a value */
- if (op2->OperIsAssignment() || (op2->OperGet() == GT_COMMA && op2->TypeGet() == TYP_VOID) || fgIsThrow(op2))
+ if (op2->OperIs(GT_ASG) || (op2->OperGet() == GT_COMMA && op2->TypeGet() == TYP_VOID) || fgIsThrow(op2))
{
typ = tree->gtType = TYP_VOID;
}
@@ -13855,7 +13855,7 @@ DONE_MORPHING_CHILDREN:
if ((op1->gtFlags & GTF_ALL_EFFECT) == 0)
{
// If tree is an asg node
- if (tree->OperIsAssignment())
+ if (tree->OperIs(GT_ASG))
{
/* Return the throw node as the new tree */
return op2->gtOp.gtOp1;
diff --git a/src/jit/optimizer.cpp b/src/jit/optimizer.cpp
index 73c79c9c2a..2420213536 100644
--- a/src/jit/optimizer.cpp
+++ b/src/jit/optimizer.cpp
@@ -5562,7 +5562,7 @@ bool Compiler::optNarrowTree(GenTree* tree, var_types srct, var_types dstt, Valu
oper = tree->OperGet();
kind = tree->OperKind();
- if (GenTree::OperIsAssignment(oper))
+ if (oper == GT_ASG)
{
noway_assert(doit == false);
return false;
@@ -5951,7 +5951,7 @@ Compiler::fgWalkResult Compiler::optIsVarAssgCB(GenTree** pTree, fgWalkData* dat
{
GenTree* tree = *pTree;
- if (tree->OperIsAssignment())
+ if (tree->OperIs(GT_ASG))
{
GenTree* dest = tree->gtOp.gtOp1;
genTreeOps destOper = dest->OperGet();
@@ -6972,7 +6972,7 @@ bool Compiler::optHoistLoopExprsForTree(GenTree* tree,
}
}
}
- else if (tree->OperIsAssignment())
+ else if (tree->OperIs(GT_ASG))
{
// If the LHS of the assignment has a global reference, then assume it's a global side effect.
GenTree* lhs = tree->gtOp.gtOp1;
@@ -7004,7 +7004,7 @@ bool Compiler::optHoistLoopExprsForTree(GenTree* tree,
if (childrenHoistable[childNum])
{
// We can't hoist the LHS of an assignment, isn't a real use.
- if (childNum == 0 && (tree->OperIsAssignment()))
+ if ((childNum == 0) && tree->OperIs(GT_ASG))
{
continue;
}
@@ -7606,7 +7606,7 @@ void Compiler::optComputeLoopSideEffectsOfBlock(BasicBlock* blk)
// We also do a very limited analysis if byref PtrTo values, to cover some cases
// that the compiler creates.
- if (GenTree::OperIsAssignment(oper))
+ if (oper == GT_ASG)
{
GenTree* lhs = tree->gtOp.gtOp1->gtEffectiveVal(/*commaOnly*/ true);
@@ -7731,7 +7731,7 @@ void Compiler::optComputeLoopSideEffectsOfBlock(BasicBlock* blk)
}
}
}
- else // not GenTree::OperIsAssignment(oper)
+ else // if (oper != GT_ASG)
{
switch (oper)
{
@@ -8096,13 +8096,13 @@ GenTree* Compiler::optFindLocalInit(BasicBlock* block,
GenTree* tree = stmt->gtStmt.gtStmtExpr;
// If we encounter an assignment to a local variable,
- if (tree->OperIsAssignment() && tree->gtOp.gtOp1->gtOper == GT_LCL_VAR)
+ if (tree->OperIs(GT_ASG) && (tree->gtOp.gtOp1->gtOper == GT_LCL_VAR))
{
// And the assigned variable equals the input local,
if (tree->gtOp.gtOp1->gtLclVarCommon.gtLclNum == LclNum)
{
// If the assignment is '=' and it is not a conditional, then return rhs.
- if (tree->gtOper == GT_ASG && !(tree->gtFlags & GTF_COLON_COND))
+ if ((tree->gtFlags & GTF_COLON_COND) == 0)
{
rhs = tree->gtOp.gtOp2;
}
diff --git a/src/jit/rangecheck.cpp b/src/jit/rangecheck.cpp
index ef47753c12..3887b2f87c 100644
--- a/src/jit/rangecheck.cpp
+++ b/src/jit/rangecheck.cpp
@@ -397,23 +397,7 @@ bool RangeCheck::IsMonotonicallyIncreasing(GenTree* expr, bool rejectNegativeCon
{
BasicBlock* asgBlock;
GenTreeOp* asg = GetSsaDefAsg(expr->AsLclVarCommon(), &asgBlock);
- if (asg == nullptr)
- {
- return false;
- }
-
- switch (asg->OperGet())
- {
- case GT_ASG:
- return IsMonotonicallyIncreasing(asg->gtGetOp2(), rejectNegativeConst);
-
- default:
- noway_assert(false);
- // All other 'asg->OperGet()' kinds, return false
- break;
- }
- JITDUMP("Unknown local definition type\n");
- return false;
+ return (asg != nullptr) && IsMonotonicallyIncreasing(asg->gtGetOp2(), rejectNegativeConst);
}
else if (expr->OperGet() == GT_ADD)
{
@@ -464,7 +448,7 @@ GenTreeOp* RangeCheck::GetSsaDefAsg(GenTreeLclVarCommon* lclUse, BasicBlock** as
// the assignment node and its destination node.
GenTree* asg = lclDef->gtNext;
- if (!asg->OperIsAssignment() || (asg->gtGetOp1() != lclDef))
+ if (!asg->OperIs(GT_ASG) || (asg->gtGetOp1() != lclDef))
{
return nullptr;
}
@@ -875,29 +859,16 @@ Range RangeCheck::ComputeRangeForLocalDef(BasicBlock* block,
JITDUMP("----------------------------------------------------\n");
}
#endif
- switch (asg->OperGet())
+ assert(asg->OperIs(GT_ASG));
+ Range range = GetRange(asgBlock, asg->gtGetOp2(), monotonic DEBUGARG(indent));
+ if (!BitVecOps::MayBeUninit(block->bbAssertionIn))
{
- // If the operator of the definition is assignment, then compute the range of the rhs.
- case GT_ASG:
- {
- Range range = GetRange(asgBlock, asg->gtGetOp2(), monotonic DEBUGARG(indent));
- if (!BitVecOps::MayBeUninit(block->bbAssertionIn))
- {
- JITDUMP("Merge assertions from " FMT_BB ":%s for assignment about [%06d]\n", block->bbNum,
- BitVecOps::ToString(m_pCompiler->apTraits, block->bbAssertionIn),
- Compiler::dspTreeID(asg->gtGetOp1()));
- MergeEdgeAssertions(asg->gtGetOp1()->AsLclVarCommon(), block->bbAssertionIn, &range);
- JITDUMP("done merging\n");
- }
- return range;
- }
-
- default:
- noway_assert(false);
- // All other 'asg->OperGet()' kinds, return Limit::keUnknown
- break;
+ JITDUMP("Merge assertions from " FMT_BB ":%s for assignment about [%06d]\n", block->bbNum,
+ BitVecOps::ToString(m_pCompiler->apTraits, block->bbAssertionIn), Compiler::dspTreeID(asg->gtGetOp1()));
+ MergeEdgeAssertions(asg->gtGetOp1()->AsLclVarCommon(), block->bbAssertionIn, &range);
+ JITDUMP("done merging\n");
}
- return Range(Limit(Limit::keUnknown));
+ return range;
}
// https://msdn.microsoft.com/en-us/windows/apps/hh285054.aspx
@@ -1011,22 +982,7 @@ bool RangeCheck::DoesVarDefOverflow(GenTreeLclVarCommon* lcl)
{
BasicBlock* asgBlock;
GenTreeOp* asg = GetSsaDefAsg(lcl, &asgBlock);
- if (asg == nullptr)
- {
- return true;
- }
-
- switch (asg->OperGet())
- {
- case GT_ASG:
- return DoesOverflow(asgBlock, asg->gtGetOp2());
-
- default:
- noway_assert(false);
- // All other 'asg->OperGet()' kinds, conservatively return true
- break;
- }
- return true;
+ return (asg == nullptr) || DoesOverflow(asgBlock, asg->gtGetOp2());
}
bool RangeCheck::DoesPhiOverflow(BasicBlock* block, GenTree* expr)
@@ -1252,7 +1208,7 @@ void RangeCheck::MapStmtDefs(const Location& loc)
if (ssaNum != SsaConfig::RESERVED_SSA_NUM)
{
// To avoid ind(addr) use asgs
- if (loc.parent->OperIsAssignment())
+ if (loc.parent->OperIs(GT_ASG))
{
SetDef(HashCode(lclNum, ssaNum), new (m_alloc) Location(loc));
}
diff --git a/src/jit/sideeffects.cpp b/src/jit/sideeffects.cpp
index 6821ab5297..75b7cc7b7f 100644
--- a/src/jit/sideeffects.cpp
+++ b/src/jit/sideeffects.cpp
@@ -160,7 +160,7 @@ AliasSet::NodeInfo::NodeInfo(Compiler* compiler, GenTree* node)
// Is the operation a write? If so, set `node` to the location that is being written to.
bool isWrite = false;
- if (node->OperIsAssignment())
+ if (node->OperIs(GT_ASG))
{
isWrite = true;
node = node->gtGetOp1();
diff --git a/src/jit/ssabuilder.cpp b/src/jit/ssabuilder.cpp
index d7347c2d87..3c94e06c08 100644
--- a/src/jit/ssabuilder.cpp
+++ b/src/jit/ssabuilder.cpp
@@ -827,7 +827,7 @@ void SsaBuilder::TreeRenameVariables(GenTree* tree, BasicBlock* block, SsaRename
{
// This is perhaps temporary -- maybe should be done elsewhere. Label GT_INDs on LHS of assignments, so we
// can skip these during (at least) value numbering.
- if (tree->OperIsAssignment())
+ if (tree->OperIs(GT_ASG))
{
GenTree* lhs = tree->gtOp.gtOp1->gtEffectiveVal(/*commaOnly*/ true);
GenTree* trueLhs = lhs->gtEffectiveVal(/*commaOnly*/ true);
@@ -844,7 +844,7 @@ void SsaBuilder::TreeRenameVariables(GenTree* tree, BasicBlock* block, SsaRename
// Figure out if "tree" may make a new GC heap state (if we care for this block).
if ((block->bbMemoryHavoc & memoryKindSet(GcHeap)) == 0)
{
- if (tree->OperIsAssignment() || tree->OperIsBlkOp())
+ if (tree->OperIs(GT_ASG) || tree->OperIsBlkOp())
{
if (m_pCompiler->ehBlockHasExnFlowDsc(block))
{
@@ -923,8 +923,8 @@ void SsaBuilder::TreeRenameVariables(GenTree* tree, BasicBlock* block, SsaRename
if ((tree->gtFlags & GTF_VAR_USEASG) != 0)
{
- // This is a partial definition of a variable. The node records the SSA number
- // of the use implied by this partial definition and the SSA number of the new
+ // This is a partial definition of a variable. The node records only the SSA number
+ // of the use that is implied by this partial definition. The SSA number of the new
// definition will be recorded in the m_opAsgnVarDefSsaNums map.
tree->AsLclVarCommon()->SetSsaNum(pRenameState->CountForUse(lclNum));
diff --git a/src/jit/treelifeupdater.cpp b/src/jit/treelifeupdater.cpp
index 1bd3b7cda2..5b5165e078 100644
--- a/src/jit/treelifeupdater.cpp
+++ b/src/jit/treelifeupdater.cpp
@@ -73,7 +73,7 @@ void TreeLifeUpdater<ForCodeGen>::UpdateLifeVar(GenTree* tree)
return;
}
- // if it's "x <op>=..." then variable "x" must have had a previous, original, site to be born.
+ // if it's a partial definition then variable "x" must have had a previous, original, site to be born.
bool isBorn = ((tree->gtFlags & GTF_VAR_DEF) != 0 && (tree->gtFlags & GTF_VAR_USEASG) == 0);
bool isDying = ((tree->gtFlags & GTF_VAR_DEATH) != 0);
bool spill = ((tree->gtFlags & GTF_SPILL) != 0);
diff --git a/src/jit/valuenum.cpp b/src/jit/valuenum.cpp
index 9ab6098b33..5e922800df 100644
--- a/src/jit/valuenum.cpp
+++ b/src/jit/valuenum.cpp
@@ -6133,21 +6133,12 @@ void Compiler::fgValueNumberTree(GenTree* tree, bool evalAsgLhsInd)
unsigned memorySsaNum;
#endif
- if (GenTree::OperIsAssignment(oper) && !varTypeIsStruct(tree))
+ if ((oper == GT_ASG) && !varTypeIsStruct(tree))
{
-
GenTree* lhs = tree->gtOp.gtOp1;
GenTree* rhs = tree->gtOp.gtOp2;
- ValueNumPair rhsVNPair;
- if (oper == GT_ASG)
- {
- rhsVNPair = rhs->gtVNPair;
- }
- else // Must be an "op="
- {
- unreached();
- }
+ ValueNumPair rhsVNPair = rhs->gtVNPair;
// Is the type being stored different from the type computed by the rhs?
if (rhs->TypeGet() != lhs->TypeGet())
@@ -7120,7 +7111,7 @@ void Compiler::fgValueNumberTree(GenTree* tree, bool evalAsgLhsInd)
}
else
{
- assert(!GenTree::OperIsAssignment(oper)); // We handled assignments earlier.
+ assert(oper != GT_ASG); // We handled assignments earlier.
assert(GenTree::OperIsBinary(oper));
// Standard binary operator.
ValueNumPair op2VNPair;