Skip to content

Commit 18270a3

Browse files
Delete GT_ASG (#85871)
* Physical promotion * Early liveness * Local morph * Add internal blocks * Object allocator * Inlining * Indirect call transformer * Patchpoint transformation * Instrumentation * Importer: production * Importer: consumption * Delete assignment rationalization * Simple dead code removal * More code removal * Fix up some comments and variable names * Fix stress * Simplify BasicBlock::FirstNonPhiDef * Duplicate a comment * Remove dead code * Fix naming and comments
1 parent c368b3d commit 18270a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1357
-2093
lines changed

src/coreclr/jit/assertionprop.cpp

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,8 +1263,7 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
12631263
// └──▌ ADD int
12641264
// ├──▌ LCL_VAR int V10 tmp6 -> copy propagated to [V35 tmp31]
12651265
// └──▌ COMMA int
1266-
// ├──▌ ASG int
1267-
// │ ├──▌ LCL_VAR int V35 tmp31
1266+
// ├──▌ STORE_LCL_VAR int V35 tmp31
12681267
// │ └──▌ LCL_FLD int V03 loc1 [+4]
12691268
if (lclVar2->lvRedefinedInEmbeddedStatement)
12701269
{
@@ -1697,7 +1696,7 @@ void Compiler::optDebugCheckAssertion(AssertionDsc* assertion)
16971696

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

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

22322231
/*****************************************************************************
22332232
*
2234-
* If this statement creates a value assignment or assertion
2235-
* then assign an index to the given value assignment by adding
2236-
* it to the lookup table, if necessary.
2233+
* If this node creates an assertion then assign an index to the assertion
2234+
* by adding it to the lookup table, if necessary.
22372235
*/
22382236
void Compiler::optAssertionGen(GenTree* tree)
22392237
{
@@ -2258,7 +2256,7 @@ void Compiler::optAssertionGen(GenTree* tree)
22582256
switch (tree->OperGet())
22592257
{
22602258
case GT_STORE_LCL_VAR:
2261-
// VN takes care of non local assertions for assignments and data flow.
2259+
// VN takes care of non local assertions for data flow.
22622260
if (optLocalAssertionProp)
22632261
{
22642262
assertionInfo = optCreateAssertion(tree, tree->AsLclVar()->Data(), OAK_EQUAL);
@@ -2587,7 +2585,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
25872585
}
25882586
else
25892587
{
2590-
// Implicit assignment conversion to float or double
2588+
// Implicit conversion to float or double
25912589
assert(varTypeIsFloating(tree->TypeGet()));
25922590
conValTree = gtNewDconNode(value, tree->TypeGet());
25932591
}
@@ -2604,7 +2602,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
26042602
}
26052603
else
26062604
{
2607-
// Implicit assignment conversion to float or double
2605+
// Implicit conversion to float or double
26082606
assert(varTypeIsFloating(tree->TypeGet()));
26092607
conValTree = gtNewDconNode(value, tree->TypeGet());
26102608
}
@@ -2631,7 +2629,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
26312629
switch (tree->TypeGet())
26322630
{
26332631
case TYP_INT:
2634-
// Implicit assignment conversion to smaller integer
2632+
// Implicit conversion to smaller integer
26352633
conValTree = gtNewIconNode(static_cast<int>(value));
26362634
break;
26372635

@@ -2693,7 +2691,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* tree)
26932691
break;
26942692

26952693
case TYP_LONG:
2696-
// Implicit assignment conversion to larger integer
2694+
// Implicit conversion to larger integer
26972695
conValTree = gtNewLconNode(value);
26982696
break;
26992697

@@ -3486,7 +3484,7 @@ GenTree* Compiler::optAssertionProp_LocalStore(ASSERT_VALARG_TP assertions, GenT
34863484
}
34873485
}
34883486

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

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

5933-
// First discover all value assignments and record them in the table.
5931+
// First discover all assertions and record them in the table.
59345932
for (BasicBlock* const block : Blocks())
59355933
{
59365934
compCurBB = block;

src/coreclr/jit/block.cpp

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,8 @@ unsigned JitPtrKeyFuncs<BasicBlock>::GetHashCode(const BasicBlock* ptr)
932932
// isEmpty: check if block is empty or contains only ignorable statements
933933
//
934934
// Return Value:
935-
// True if block is empty, or contains only PHI assignments,
936-
// or contains zero or more PHI assignments followed by NOPs.
935+
// True if block is empty, or contains only PHI stores,
936+
// or contains zero or more PHI stores followed by NOPs.
937937
//
938938
bool BasicBlock::isEmpty() const
939939
{
@@ -985,34 +985,23 @@ bool BasicBlock::isValid() const
985985
Statement* BasicBlock::FirstNonPhiDef() const
986986
{
987987
Statement* stmt = firstStmt();
988-
if (stmt == nullptr)
989-
{
990-
return nullptr;
991-
}
992-
GenTree* tree = stmt->GetRootNode();
993-
while ((tree->OperGet() == GT_ASG && tree->AsOp()->gtOp2->OperGet() == GT_PHI) ||
994-
(tree->OperGet() == GT_STORE_LCL_VAR && tree->AsOp()->gtOp1->OperGet() == GT_PHI))
988+
while ((stmt != nullptr) && stmt->IsPhiDefnStmt())
995989
{
996990
stmt = stmt->GetNextStmt();
997-
if (stmt == nullptr)
998-
{
999-
return nullptr;
1000-
}
1001-
tree = stmt->GetRootNode();
1002991
}
992+
1003993
return stmt;
1004994
}
1005995

1006-
Statement* BasicBlock::FirstNonPhiDefOrCatchArgAsg() const
996+
Statement* BasicBlock::FirstNonPhiDefOrCatchArgStore() const
1007997
{
1008998
Statement* stmt = FirstNonPhiDef();
1009999
if (stmt == nullptr)
10101000
{
10111001
return nullptr;
10121002
}
10131003
GenTree* tree = stmt->GetRootNode();
1014-
if ((tree->OperGet() == GT_ASG && tree->AsOp()->gtOp2->OperGet() == GT_CATCH_ARG) ||
1015-
(tree->OperGet() == GT_STORE_LCL_VAR && tree->AsOp()->gtOp1->OperGet() == GT_CATCH_ARG))
1004+
if (tree->OperIs(GT_STORE_LCL_VAR) && tree->AsLclVar()->Data()->OperIs(GT_CATCH_ARG))
10161005
{
10171006
stmt = stmt->GetNextStmt();
10181007
}

src/coreclr/jit/block.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ struct BasicBlock : private LIR::Range
11171117
// BAD_IL_OFFSET.
11181118
#endif // DEBUG
11191119

1120-
VARSET_TP bbVarUse; // variables used by block (before an assignment)
1120+
VARSET_TP bbVarUse; // variables used by block (before a definition)
11211121
VARSET_TP bbVarDef; // variables assigned by block (before a use)
11221122

11231123
VARSET_TP bbLiveIn; // variables live on entry
@@ -1172,17 +1172,17 @@ struct BasicBlock : private LIR::Range
11721172

11731173
union {
11741174
EXPSET_TP bbCseGen; // CSEs computed by block
1175-
ASSERT_TP bbAssertionGen; // value assignments computed by block
1175+
ASSERT_TP bbAssertionGen; // assertions computed by block
11761176
};
11771177

11781178
union {
11791179
EXPSET_TP bbCseIn; // CSEs available on entry
1180-
ASSERT_TP bbAssertionIn; // value assignments available on entry
1180+
ASSERT_TP bbAssertionIn; // assertions available on entry
11811181
};
11821182

11831183
union {
11841184
EXPSET_TP bbCseOut; // CSEs available on exit
1185-
ASSERT_TP bbAssertionOut; // value assignments available on exit
1185+
ASSERT_TP bbAssertionOut; // assertions available on exit
11861186
};
11871187

11881188
void* bbEmitCookie;
@@ -1280,9 +1280,9 @@ struct BasicBlock : private LIR::Range
12801280
bool endsWithTailCallConvertibleToLoop(Compiler* comp, GenTree** tailCall) const;
12811281

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

12871287
BasicBlock() : bbStmtList(nullptr), bbLiveIn(VarSetOps::UninitVal()), bbLiveOut(VarSetOps::UninitVal())
12881288
{

src/coreclr/jit/clrjit.natvis

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ Documentation for VS debugger format specifiers: https://docs.microsoft.com/en-u
5757
<DisplayString>{gtTreeID, d}: [LngCon={((GenTreeLngCon*)this)-&gt;gtLconVal, l}]</DisplayString>
5858
</Type>
5959
<Type Name="GenTreeOp">
60-
<DisplayString Condition="this->gtOper==GT_ASG">{gtTreeID, d}: [{this-&gt;gtOp1,na}={this-&gt;gtOp2,na}]</DisplayString>
6160
<DisplayString Condition="this->gtOper==GT_CAST">{gtTreeID, d}: [{((GenTreeCast*)this)-&gt;gtCastType,en} &lt;- {((GenTreeUnOp*)this)-&gt;gtOp1-&gt;gtType,en}]</DisplayString>
6261
<DisplayString Condition="this->gtOper==GT_HWINTRINSIC">{gtTreeID, d}: [{((GenTreeHWIntrinsic*)this)-&gt;gtHWIntrinsicId,en}, {gtType,en}]</DisplayString>
6362
<DisplayString>{gtTreeID, d}: [{gtOper,en}, {gtType,en}]</DisplayString>

src/coreclr/jit/compiler.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ unsigned argTotalDeferred;
241241
unsigned argTotalConst;
242242

243243
unsigned argTotalObjPtr;
244-
unsigned argTotalGTF_ASGinArgs;
245244

246245
unsigned argMaxTempsPerMethod;
247246

@@ -1919,7 +1918,6 @@ void Compiler::compInit(ArenaAllocator* pAlloc,
19191918
compLocallocUsed = false;
19201919
compLocallocOptimized = false;
19211920
compQmarkRationalized = false;
1922-
compAssignmentRationalized = false;
19231921
compQmarkUsed = false;
19241922
compFloatingPointUsed = false;
19251923

@@ -4747,8 +4745,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl
47474745
//
47484746
DoPhase(this, PHASE_PHYSICAL_PROMOTION, &Compiler::PhysicalPromotion);
47494747

4750-
DoPhase(this, PHASE_RATIONALIZE_ASSIGNMENTS, &Compiler::fgRationalizeAssignments);
4751-
47524748
// Run a simple forward substitution pass.
47534749
//
47544750
DoPhase(this, PHASE_FWD_SUB, &Compiler::fgForwardSub);

0 commit comments

Comments
 (0)