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 simple quirks left from the ASG removal #86726

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
35 changes: 4 additions & 31 deletions src/coreclr/jit/assertionprop.cpp
Expand Up @@ -3289,11 +3289,8 @@ GenTree* Compiler::optCopyAssertionProp(AssertionDsc* curAssertion,
//
GenTree* Compiler::optAssertionProp_LclVar(ASSERT_VALARG_TP assertions, GenTreeLclVarCommon* tree, Statement* stmt)
{
// If we have a var definition then bail or
// If this is the address of the var then it will have the GTF_DONT_CSE
// flag set and we don't want to assertion prop on it.
// TODO-ASG: delete.
if (tree->gtFlags & (GTF_VAR_DEF | GTF_DONT_CSE))
// TODO-Cleanup: delete. Requires annotating locals propagated into multi-regs.
if ((tree->gtFlags & GTF_DONT_CSE) != 0)
{
return nullptr;
}
Expand Down Expand Up @@ -3395,15 +3392,6 @@ GenTree* Compiler::optAssertionProp_LclVar(ASSERT_VALARG_TP assertions, GenTreeL
//
GenTree* Compiler::optAssertionProp_LclFld(ASSERT_VALARG_TP assertions, GenTreeLclVarCommon* tree, Statement* stmt)
{
// If we have a var definition then bail or
// If this is the address of the var then it will have the GTF_DONT_CSE
// flag set and we don't want to assertion prop on it.
// TODO-ASG: delete.
if (tree->gtFlags & (GTF_VAR_DEF | GTF_DONT_CSE))
{
return nullptr;
}

// Only run during local prop and if copies are available.
//
if (!optLocalAssertionProp || !optCanPropLclVar)
Expand Down Expand Up @@ -5724,24 +5712,18 @@ GenTree* Compiler::optVNConstantPropOnJTrue(BasicBlock* block, GenTree* test)
Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Statement* stmt, GenTree* tree)
{
// Don't perform const prop on expressions marked with GTF_DONT_CSE
// TODO-ASG: delete.
// TODO-Cleanup: delete. This is now only needed for the casts under a GTF_MUL_64RSLT node to stay intact.
if (!tree->CanCSE())
{
return WALK_CONTINUE;
}

// Don't propagate floating-point constants into a TYP_STRUCT LclVar
// This can occur for HFA return values (see hfa_sf3E_r.exe)
if (tree->TypeGet() == TYP_STRUCT)
{
return WALK_CONTINUE;
}

switch (tree->OperGet())
{
// Make sure we have an R-value.
case GT_ADD:
case GT_SUB:
case GT_MUL:
case GT_DIV:
case GT_MOD:
case GT_UDIV:
Expand All @@ -5768,7 +5750,6 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Sta
case GT_ARR_LENGTH:
break;

case GT_BLK:
case GT_IND:
{
const ValueNum vn = tree->GetVN(VNK_Conservative);
Expand All @@ -5782,14 +5763,6 @@ Compiler::fgWalkResult Compiler::optVNConstantPropCurStmt(BasicBlock* block, Sta
case GT_JTRUE:
break;

case GT_MUL:
// Don't transform long multiplies.
if (tree->gtFlags & GTF_MUL_64RSLT)
{
return WALK_CONTINUE;
}
break;

case GT_LCL_VAR:
case GT_LCL_FLD:
// Let's not conflict with CSE (to save the movw/movt).
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/jit/earlyprop.cpp
Expand Up @@ -771,12 +771,6 @@ bool Compiler::optCanMoveNullCheckPastTree(GenTree* tree,
{
// We disallow stores to global memory.
result = tree->OperIsLocalStore() && !lvaGetDesc(tree->AsLclVarCommon())->IsAddressExposed();

// TODO-ASG-Cleanup: delete this zero-diff quirk. Some setup args for by-ref args do not have GLOB_REF.
if ((tree->gtFlags & GTF_GLOB_REF) == 0)
{
result = true;
}
}
}
else if (checkSideEffectSummary)
Expand Down
6 changes: 0 additions & 6 deletions src/coreclr/jit/importer.cpp
Expand Up @@ -9059,12 +9059,6 @@ void Compiler::impImportBlockCode(BasicBlock* block)
lclTyp = TypeHandleToVarType(fieldInfo.fieldType, clsHnd, &layout);
op1 = (lclTyp == TYP_STRUCT) ? gtNewBlkIndir(layout, op1, indirFlags)
: gtNewIndir(lclTyp, op1, indirFlags);
if ((indirFlags & GTF_IND_INVARIANT) != 0)
{
// TODO-ASG: delete this zero-diff quirk.
op1->gtFlags |= GTF_GLOB_REF;
}

impAnnotateFieldIndir(op1->AsIndir());
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/lclmorph.cpp
Expand Up @@ -1273,7 +1273,7 @@ class LocalAddressVisitor final : public GenTreeVisitor<LocalAddressVisitor>
else
{
node->ChangeOper(GT_LCL_VAR);
node->gtFlags &= (GTF_NODE_MASK | GTF_DONT_CSE); // TODO-ASG-Cleanup: delete this zero-diff quirk.
node->gtFlags = GTF_EMPTY;
}
node->AsLclVar()->SetLclNum(fieldLclNum);
node->gtType = fieldType;
Expand Down
7 changes: 2 additions & 5 deletions src/coreclr/jit/morph.cpp
Expand Up @@ -4578,8 +4578,7 @@ GenTree* Compiler::fgMorphLeafLocal(GenTreeLclVarCommon* lclNode)
// normalized on store. If this is one of the former, insert a narrowing cast on the load.
// ie. Convert: var-short --> cast-short(var-int)
//
if (fgGlobalMorph && lclNode->OperIs(GT_LCL_VAR) && varDsc->lvNormalizeOnLoad() &&
/* TODO-ASG: delete this zero-diff quirk */ lclNode->CanCSE())
if (fgGlobalMorph && lclNode->OperIs(GT_LCL_VAR) && varDsc->lvNormalizeOnLoad())
{
var_types lclVarType = varDsc->TypeGet();

Expand Down Expand Up @@ -7429,7 +7428,6 @@ void Compiler::fgMorphRecursiveFastTailCallIntoLoop(BasicBlock* block, GenTreeCa
{
GenTree* zero = (lclType == TYP_STRUCT) ? gtNewIconNode(0) : gtNewZeroConNode(lclType);
GenTree* init = gtNewStoreLclVarNode(varNum, zero);
init->gtType = lclType; // TODO-ASG: delete this zero-diff quirk.
if (lclType == TYP_STRUCT)
{
init = fgMorphInitBlock(init);
Expand Down Expand Up @@ -9772,8 +9770,7 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optA
// Propagate comma throws.
// If we are in the Valuenum CSE phase then don't morph away anything as these
// nodes may have CSE defs/uses in them.
if (fgGlobalMorph && (oper != GT_COLON) &&
/* TODO-ASG-Cleanup: delete this zero-diff quirk */ !GenTree::OperIsStore(oper))
if (fgGlobalMorph && (oper != GT_COLON))
{
if ((op1 != nullptr) && fgIsCommaThrow(op1, true))
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/ssabuilder.cpp
Expand Up @@ -519,7 +519,6 @@ void SsaBuilder::InsertPhi(BasicBlock* block, unsigned lclNum)
phi->SetCosts(0, 0);
GenTree* store = m_pCompiler->gtNewStoreLclVarNode(lclNum, phi);
store->SetCosts(0, 0);
store->gtType = type; // TODO-ASG-Cleanup: delete. This quirk avoided diffs from costing-induced tail dup.

// Create the statement and chain everything in linear order - PHI, STORE_LCL_VAR.
Statement* stmt = m_pCompiler->gtNewStmt(store);
Expand Down