Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Remove some GT_ASG_op leftovers #18205

Merged
merged 1 commit into from
Aug 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4098,8 +4098,8 @@ class Compiler

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;
Expand All @@ -4121,7 +4121,7 @@ class Compiler

// 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);

Expand Down Expand Up @@ -5497,7 +5497,7 @@ class Compiler

/* 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.)
Expand Down
68 changes: 22 additions & 46 deletions src/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this assert was deleted?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it odd to assert that a pointer is non-null when you're going to dereference it on the next line anyway. Such asserts are typically used when you store the pointer for later use and want to avoid wasting your time trying to figure out how did the null get there.

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
}

Expand All @@ -3454,31 +3444,17 @@ 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;
}

//-----------------------------------------------------------------------------

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()
Expand Down Expand Up @@ -4343,7 +4319,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;
Expand Down
8 changes: 4 additions & 4 deletions src/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -25493,7 +25493,7 @@ class FatCalliTransformer
bool ContainsFatCalli(GenTreeStmt* stmt)
{
GenTree* fatPointerCandidate = stmt->gtStmtExpr;
if (fatPointerCandidate->OperIsAssignment())
if (fatPointerCandidate->OperIs(GT_ASG))
{
fatPointerCandidate = fatPointerCandidate->gtGetOp2();
}
Expand All @@ -25510,7 +25510,7 @@ class FatCalliTransformer
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();
Expand Down Expand Up @@ -25547,7 +25547,7 @@ class FatCalliTransformer
GenTreeCall* call = nullptr;
if (doesReturnValue)
{
assert(tree->OperIsAssignment());
assert(tree->OperIs(GT_ASG));
call = tree->gtGetOp2()->AsCall();
}
else
Expand Down
17 changes: 4 additions & 13 deletions src/jit/gcinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*****************************************************************************/
Expand Down
Loading