Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete GT_ASG #85871

Merged
merged 22 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from 15 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
34 changes: 16 additions & 18 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,7 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
// └──▌ ADD int
// ├──▌ LCL_VAR int V10 tmp6 -> copy propagated to [V35 tmp31]
// └──▌ COMMA int
// ├──▌ ASG int
// │ ├──▌ LCL_VAR int V35 tmp31
// ├──▌ STORE_LCL_VAR int V35 tmp31
// │ └──▌ LCL_FLD int V03 loc1 [+4]
if (lclVar2->lvRedefinedInEmbeddedStatement)
{
Expand Down Expand Up @@ -1697,7 +1696,7 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion)

case O2K_ZEROOBJ:
{
// We only make these assertion for assignments (not control flow).
// We only make these assertion for stores (not control flow).
assert(assertion->assertionKind == OAK_EQUAL);
// We use "optLocalAssertionIsEqualOrNotEqual" to find these.
assert(assertion->op2.u1.iconVal == 0);
Expand Down Expand Up @@ -2080,8 +2079,8 @@ AssertionInfo Compiler::optAssertionGenJtrue(GenTree* tree)
// Look through any CSEs so we see the actual trees providing values, if possible.
// This is important for exact type assertions, which need to see the GT_IND.
//
GenTree* op1 = relop->AsOp()->gtOp1->gtCommaAssignVal();
GenTree* op2 = relop->AsOp()->gtOp2->gtCommaAssignVal();
GenTree* op1 = relop->AsOp()->gtOp1->gtCommaStoreVal();
GenTree* op2 = relop->AsOp()->gtOp2->gtCommaStoreVal();

// Check for op1 or op2 to be lcl var and if so, keep it in op1.
if ((op1->gtOper != GT_LCL_VAR) && (op2->gtOper == GT_LCL_VAR))
Expand Down Expand Up @@ -2231,9 +2230,8 @@ AssertionIndex Compiler::optAssertionGenPhiDefn(GenTree* tree)

/*****************************************************************************
*
* If this statement creates a value assignment or assertion
* then assign an index to the given value assignment by adding
* it to the lookup table, if necessary.
* If this node creates an assertion then assign an index to the assertion
* by adding it to the lookup table, if necessary.
*/
void Compiler::optAssertionGen(GenTree* tree)
{
Expand All @@ -2258,7 +2256,7 @@ void Compiler::optAssertionGen(GenTree* tree)
switch (tree->OperGet())
{
case GT_STORE_LCL_VAR:
// VN takes care of non local assertions for assignments and data flow.
// VN takes care of non local assertions for data flow.
if (optLocalAssertionProp)
{
assertionInfo = optCreateAssertion(tree, tree->AsLclVar()->Data(), OAK_EQUAL);
Expand Down Expand Up @@ -2587,7 +2585,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
}
else
{
// Implicit assignment conversion to float or double
// Implicit conversion to float or double
assert(varTypeIsFloating(tree->TypeGet()));
conValTree = gtNewDconNode(value, tree->TypeGet());
}
Expand All @@ -2604,7 +2602,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
}
else
{
// Implicit assignment conversion to float or double
// Implicit conversion to float or double
assert(varTypeIsFloating(tree->TypeGet()));
conValTree = gtNewDconNode(value, tree->TypeGet());
}
Expand All @@ -2631,7 +2629,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
switch (tree->TypeGet())
{
case TYP_INT:
// Implicit assignment conversion to smaller integer
// Implicit conversion to smaller integer
conValTree = gtNewIconNode(static_cast<int>(value));
break;

Expand Down Expand Up @@ -2693,7 +2691,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
break;

case TYP_LONG:
// Implicit assignment conversion to larger integer
// Implicit conversion to larger integer
conValTree = gtNewLconNode(value);
break;

Expand Down Expand Up @@ -3486,7 +3484,7 @@ GenTree* Compiler::optAssertionProp_LocalStore(ASSERT_VALARG_TP assertions, GenT
}
}

// We might have simplified the value but were not able to remove the assignment
// We might have simplified the value but were not able to remove the store.
//
if (madeChanges)
{
Expand Down Expand Up @@ -3959,7 +3957,7 @@ GenTree* Compiler::optAssertionPropGlobal_RelOp(ASSERT_VALARG_TP assertions, Gen
// Note we can't trust the OAK_EQUAL as the value could end up being a NaN
// violating the assertion. However, we create OAK_EQUAL assertions for floating
// point only on JTrue nodes, so if the condition held earlier, it will hold
// now. We don't create OAK_EQUAL assertion on floating point from GT_ASG
// now. We don't create OAK_EQUAL assertion on floating point from stores
// because we depend on value num which would constant prop the NaN.
op1->BashToConst(0.0, op1->TypeGet());
op2->BashToConst(0.0, op2->TypeGet());
Expand Down Expand Up @@ -4872,7 +4870,7 @@ void Compiler::optImpliedAssertions(AssertionIndex assertionIndex, ASSERT_TP& ac
}
}
}
// Is curAssertion a constant assignment of a 32-bit integer?
// Is curAssertion a constant store of a 32-bit integer?
// (i.e GT_LVL_VAR X == GT_CNS_INT)
else if ((curAssertion->assertionKind == OAK_EQUAL) && (curAssertion->op1.kind == O1K_LCLVAR) &&
(curAssertion->op2.kind == O2K_CONST_INT))
Expand Down Expand Up @@ -5119,7 +5117,7 @@ void Compiler::optImpliedByCopyAssertion(AssertionDsc* copyAssertion, AssertionD
return;
}

// Is depAssertion a constant assignment of a 32-bit integer?
// Is depAssertion a constant store of a 32-bit integer?
// (i.e GT_LVL_VAR X == GT_CNS_INT)
bool depIsConstAssertion = ((depAssertion->assertionKind == OAK_EQUAL) && (depAssertion->op1.kind == O1K_LCLVAR) &&
(depAssertion->op2.kind == O2K_CONST_INT));
Expand Down Expand Up @@ -5930,7 +5928,7 @@ PhaseStatus Compiler::optAssertionPropMain()
// Assertion prop can speculatively create trees.
INDEBUG(const unsigned baseTreeID = compGenTreeID);

// First discover all value assignments and record them in the table.
// First discover all assertions and record them in the table.
for (BasicBlock* const block : Blocks())
{
compCurBB = block;
Expand Down
20 changes: 7 additions & 13 deletions src/coreclr/jit/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,8 @@ unsigned JitPtrKeyFuncs<BasicBlock>::GetHashCode(const BasicBlock* ptr)
// isEmpty: check if block is empty or contains only ignorable statements
//
// Return Value:
// True if block is empty, or contains only PHI assignments,
// or contains zero or more PHI assignments followed by NOPs.
// True if block is empty, or contains only PHI stores,
// or contains zero or more PHI stores followed by NOPs.
//
bool BasicBlock::isEmpty() const
{
Expand Down Expand Up @@ -986,30 +986,24 @@ Statement* BasicBlock::FirstNonPhiDef() const
{
return nullptr;
}
GenTree* tree = stmt->GetRootNode();
while ((tree->OperGet() == GT_ASG && tree->AsOp()->gtOp2->OperGet() == GT_PHI) ||
(tree->OperGet() == GT_STORE_LCL_VAR && tree->AsOp()->gtOp1->OperGet() == GT_PHI))

while ((stmt != nullptr) && stmt->IsPhiDefnStmt())
SingleAccretion marked this conversation as resolved.
Show resolved Hide resolved
{
stmt = stmt->GetNextStmt();
if (stmt == nullptr)
{
return nullptr;
}
tree = stmt->GetRootNode();
}

return stmt;
}

Statement* BasicBlock::FirstNonPhiDefOrCatchArgAsg() const
Statement* BasicBlock::FirstNonPhiDefOrCatchArgStore() const
{
Statement* stmt = FirstNonPhiDef();
if (stmt == nullptr)
{
return nullptr;
}
GenTree* tree = stmt->GetRootNode();
if ((tree->OperGet() == GT_ASG && tree->AsOp()->gtOp2->OperGet() == GT_CATCH_ARG) ||
(tree->OperGet() == GT_STORE_LCL_VAR && tree->AsOp()->gtOp1->OperGet() == GT_CATCH_ARG))
if (tree->OperIs(GT_STORE_LCL_VAR) && tree->AsLclVar()->Data()->OperIs(GT_CATCH_ARG))
{
stmt = stmt->GetNextStmt();
}
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ struct BasicBlock : private LIR::Range
// BAD_IL_OFFSET.
#endif // DEBUG

VARSET_TP bbVarUse; // variables used by block (before an assignment)
VARSET_TP bbVarUse; // variables used by block (before a definition)
VARSET_TP bbVarDef; // variables assigned by block (before a use)

VARSET_TP bbLiveIn; // variables live on entry
Expand Down Expand Up @@ -1165,17 +1165,17 @@ struct BasicBlock : private LIR::Range

union {
EXPSET_TP bbCseGen; // CSEs computed by block
ASSERT_TP bbAssertionGen; // value assignments computed by block
ASSERT_TP bbAssertionGen; // assertions computed by block
};

union {
EXPSET_TP bbCseIn; // CSEs available on entry
ASSERT_TP bbAssertionIn; // value assignments available on entry
ASSERT_TP bbAssertionIn; // assertions available on entry
};

union {
EXPSET_TP bbCseOut; // CSEs available on exit
ASSERT_TP bbAssertionOut; // value assignments available on exit
ASSERT_TP bbAssertionOut; // assertions available on exit
};

void* bbEmitCookie;
Expand Down Expand Up @@ -1273,9 +1273,9 @@ struct BasicBlock : private LIR::Range
bool endsWithTailCallConvertibleToLoop(Compiler* comp, GenTree** tailCall) const;

// Returns the first statement in the statement list of "this" that is
// not an SSA definition (a lcl = phi(...) assignment).
// not an SSA definition (a lcl = phi(...) store).
Statement* FirstNonPhiDef() const;
Statement* FirstNonPhiDefOrCatchArgAsg() const;
Statement* FirstNonPhiDefOrCatchArgStore() const;

BasicBlock() : bbStmtList(nullptr), bbLiveIn(VarSetOps::UninitVal()), bbLiveOut(VarSetOps::UninitVal())
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/clrjit.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Documentation for VS debugger format specifiers: https://docs.microsoft.com/en-u
<DisplayString>{gtTreeID, d}: [LngCon={((GenTreeLngCon*)this)-&gt;gtLconVal, l}]</DisplayString>
</Type>
<Type Name="GenTreeOp">
<DisplayString Condition="this->gtOper==GT_ASG">{gtTreeID, d}: [{this-&gt;gtOp1,na}={this-&gt;gtOp2,na}]</DisplayString>
<DisplayString Condition="this->gtOper==GT_CAST">{gtTreeID, d}: [{((GenTreeCast*)this)-&gt;gtCastType,en} &lt;- {((GenTreeUnOp*)this)-&gt;gtOp1-&gt;gtType,en}]</DisplayString>
<DisplayString Condition="this->gtOper==GT_HWINTRINSIC">{gtTreeID, d}: [{((GenTreeHWIntrinsic*)this)-&gt;gtHWIntrinsicId,en}, {gtType,en}]</DisplayString>
<DisplayString>{gtTreeID, d}: [{gtOper,en}, {gtType,en}]</DisplayString>
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ unsigned argTotalDeferred;
unsigned argTotalConst;

unsigned argTotalObjPtr;
unsigned argTotalGTF_ASGinArgs;

unsigned argMaxTempsPerMethod;

Expand Down Expand Up @@ -1919,7 +1918,6 @@ void Compiler::compInit(ArenaAllocator* pAlloc,
compLocallocUsed = false;
compLocallocOptimized = false;
compQmarkRationalized = false;
compAssignmentRationalized = false;
compQmarkUsed = false;
compFloatingPointUsed = false;

Expand Down Expand Up @@ -4734,8 +4732,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
//
DoPhase(this, PHASE_PHYSICAL_PROMOTION, &Compiler::PhysicalPromotion);

DoPhase(this, PHASE_RATIONALIZE_ASSIGNMENTS, &Compiler::fgRationalizeAssignments);

// Run a simple forward substitution pass.
//
DoPhase(this, PHASE_FWD_SUB, &Compiler::fgForwardSub);
Expand Down
Loading