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

Fold full-width SIMD-typed indirections #76745

Merged
merged 4 commits into from
Oct 31, 2022
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
30 changes: 0 additions & 30 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1657,38 +1657,8 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
goto DONE_ASSERTION;
}

//
// Copy Assertions
//
case GT_OBJ:
case GT_BLK:
{
// TODO-ADDR: delete once local morph folds SIMD-typed indirections.
//
GenTree* const addr = op2->AsIndir()->Addr();

if (addr->OperIs(GT_ADDR))
{
GenTree* const base = addr->AsOp()->gtOp1;

if (base->OperIs(GT_LCL_VAR) && varTypeIsStruct(base))
{
ClassLayout* const varLayout = base->GetLayout(this);
ClassLayout* const objLayout = op2->GetLayout(this);
if (ClassLayout::AreCompatible(varLayout, objLayout))
{
op2 = base;
goto IS_COPY;
}
}
}

goto DONE_ASSERTION;
}

case GT_LCL_VAR:
{
IS_COPY:
//
// Must either be an OAK_EQUAL or an OAK_NOT_EQUAL assertion
//
Expand Down
13 changes: 0 additions & 13 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5756,7 +5756,6 @@ class Compiler
GenTree* fgMorphMultiOp(GenTreeMultiOp* multiOp);
GenTree* fgMorphConst(GenTree* tree);

GenTreeLclVar* fgMorphTryFoldObjAsLclVar(GenTreeObj* obj, bool destroyNodes = true);
GenTreeOp* fgMorphCommutative(GenTreeOp* tree);
GenTree* fgMorphCastedBitwiseOp(GenTreeOp* tree);

Expand Down Expand Up @@ -8473,18 +8472,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
return (intrinsicId == SIMDIntrinsicEqual);
}

// Returns base JIT type of a TYP_SIMD local.
// Returns CORINFO_TYPE_UNDEF if the local is not TYP_SIMD.
CorInfoType getBaseJitTypeOfSIMDLocal(GenTree* tree)
{
if (isSIMDTypeLocal(tree))
{
return lvaGetDesc(tree->AsLclVarCommon())->GetSimdBaseJitType();
}

return CORINFO_TYPE_UNDEF;
}

bool isNumericsNamespace(const char* ns)
{
return strcmp(ns, "System.Numerics") == 0;
Expand Down
19 changes: 0 additions & 19 deletions src/coreclr/jit/forwardsub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,25 +630,6 @@ bool Compiler::fgForwardSubStatement(Statement* stmt)
}
}

// Optimization:
//
// If we are about to substitute GT_OBJ, see if we can simplify it first.
// Not doing so can lead to regressions...
//
// Hold off on doing this for call args for now (per issue #51569).
// Hold off on OBJ(GT_LCL_ADDR).
//
if (fwdSubNode->OperIs(GT_OBJ) && !fsv.IsCallArg() && fwdSubNode->gtGetOp1()->OperIs(GT_ADDR))
{
const bool destroyNodes = false;
GenTree* const optTree = fgMorphTryFoldObjAsLclVar(fwdSubNode->AsObj(), destroyNodes);
if (optTree != nullptr)
{
JITDUMP(" [folding OBJ(ADDR(LCL...))]");
fwdSubNode = optTree;
}
}

// Quirks:
//
// Don't substitute nodes "AddFinalArgsAndDetermineABIInfo" doesn't handle into struct args.
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -4381,8 +4381,6 @@ struct CallArgABIInformation
// argument type, but when a struct is passed as a scalar type, this is
// that type. Note that if a struct is passed by reference, this will still
// be the struct type.
// TODO-ARGS: Reconsider whether we need this, it does not make much sense
// to have this instead of using just the type of the arg node.
var_types ArgType : 5;
// True when the argument fills a register slot skipped due to alignment
// requirements of previous arguments.
Expand Down
15 changes: 8 additions & 7 deletions src/coreclr/jit/lclmorph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,13 +991,6 @@ class LocalAddressVisitor final : public GenTreeVisitor<LocalAddressVisitor>

LclVarDsc* varDsc = m_compiler->lvaGetDesc(val.LclNum());

if (varTypeIsSIMD(varDsc))
{
// TODO-ADDR: skip SIMD variables for now, fgMorphFieldAssignToSimdSetElement and
// others need to be updated to recognize LCL_FLDs.
return IndirTransform::None;
}

if (indir->TypeGet() != TYP_STRUCT)
{
if (varDsc->lvPromoted)
Expand All @@ -1012,6 +1005,14 @@ class LocalAddressVisitor final : public GenTreeVisitor<LocalAddressVisitor>
return IndirTransform::LclVar;
}

if (varTypeIsSIMD(varDsc))
{
// TODO-ADDR: skip SIMD variables for now, fgMorphFieldAssignToSimdSetElement and
// fgMorphFieldToSimdGetElement need to be updated to recognize LCL_FLDs or moved
// here.
return IndirTransform::None;
}

// Bool and ubyte are the same type.
if ((indir->TypeIs(TYP_BOOL) && (varDsc->TypeGet() == TYP_UBYTE)) ||
(indir->TypeIs(TYP_UBYTE) && (varDsc->TypeGet() == TYP_BOOL)))
Expand Down
Loading