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 a bit of dead code #77655

Merged
merged 6 commits into from
Nov 1, 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
1 change: 0 additions & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -5740,7 +5740,6 @@ class Compiler
GenTree* fgMorphBlockOperand(GenTree* tree, var_types asgType, ClassLayout* blockLayout, bool isBlkReqd);
GenTree* fgMorphCopyBlock(GenTree* tree);
GenTree* fgMorphStoreDynBlock(GenTreeStoreDynBlk* tree);
GenTree* fgMorphForRegisterFP(GenTree* tree);
GenTree* fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optAssertionPropDone = nullptr);
void fgTryReplaceStructLocalWithField(GenTree* tree);
GenTree* fgOptimizeCast(GenTreeCast* cast);
Expand Down
30 changes: 4 additions & 26 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15372,40 +15372,24 @@ GenTree* Compiler::gtNewTempAssign(
if (genActualType(valTyp) != genActualType(dstTyp))
{
// Plus some other exceptions that are apparently legal:
// 1) TYP_REF or BYREF = TYP_I_IMPL
// - TYP_REF or BYREF = TYP_I_IMPL
bool ok = false;
if (varTypeIsGC(dstTyp) && (valTyp == TYP_I_IMPL))
{
ok = true;
}
// 2) TYP_DOUBLE = TYP_FLOAT or TYP_FLOAT = TYP_DOUBLE
SingleAccretion marked this conversation as resolved.
Show resolved Hide resolved
else if (varTypeIsFloating(dstTyp) && varTypeIsFloating(valTyp))
{
ok = true;
}
// 3) TYP_BYREF = TYP_REF when object stack allocation is enabled
// - TYP_BYREF = TYP_REF when object stack allocation is enabled
else if (JitConfig.JitObjectStackAllocation() && (dstTyp == TYP_BYREF) && (valTyp == TYP_REF))
{
ok = true;
}
else if (!varTypeIsGC(dstTyp) && (genTypeSize(valTyp) == genTypeSize(dstTyp)))
{
// We can have assignments that require a change of register file, e.g. for arguments
// and call returns. Lowering and Codegen will handle these.
ok = true;
}
else if ((dstTyp == TYP_STRUCT) && (valTyp == TYP_INT))
{
// It could come from `ASG(struct, 0)` that was propagated to `RETURN struct(0)`,
// and now it is merging to a struct again.
assert(tmp == genReturnLocal);
ok = true;
}
else if (varTypeIsSIMD(dstTyp) && (valTyp == TYP_STRUCT))
{
assert(val->IsCall());
ok = true;
}

if (!ok)
{
Expand Down Expand Up @@ -15435,7 +15419,6 @@ GenTree* Compiler::gtNewTempAssign(

GenTree* asg;
GenTree* dest = gtNewLclvNode(tmp, dstTyp);
dest->gtFlags |= GTF_VAR_DEF;

// With first-class structs, we should be propagating the class handle on all non-primitive
// struct types. We don't have a convenient way to do that for all SIMD temps, since some
Expand Down Expand Up @@ -15472,18 +15455,13 @@ GenTree* Compiler::gtNewTempAssign(
{
assert(valx->gtOper != GT_OBJ);
}
dest->gtFlags |= GTF_DONT_CSE;

valx->gtFlags |= GTF_DONT_CSE;
asg = impAssignStruct(dest, val, valStructHnd, CHECK_SPILL_NONE, pAfterStmt, di, block);
}
else
{
// We may have a scalar type variable assigned a struct value, e.g. a 'genReturnLocal'
// when the ABI calls for returning a struct as a primitive type.
// TODO-1stClassStructs: When we stop "lying" about the types for ABI purposes, the
// 'genReturnLocal' should be the original struct type.
assert(!varTypeIsStruct(valTyp) || ((valStructHnd != NO_CLASS_HANDLE) &&
(typGetObjLayout(valStructHnd)->GetSize() == genTypeSize(varDsc))));
assert(!varTypeIsStruct(valTyp));
asg = gtNewAssignNode(dest, val);
}

Expand Down
40 changes: 7 additions & 33 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1162,8 +1162,7 @@ GenTree* Compiler::impAssignStructPtr(GenTree* destAddr,
BasicBlock* block /* = NULL */
)
{
GenTree* dest = nullptr;
GenTreeFlags destFlags = GTF_EMPTY;
GenTree* dest = nullptr;

DebugInfo usedDI = di;
if (!usedDI.IsValid())
Expand Down Expand Up @@ -1498,9 +1497,6 @@ GenTree* Compiler::impAssignStructPtr(GenTree* destAddr,
lvaGetDesc(dest->AsLclVar())->lvIsMultiRegRet = true;
}

dest->gtFlags |= destFlags;
destFlags = dest->gtFlags;

// return an assignment node, to be appended
GenTree* asgNode = gtNewAssignNode(dest, src);
gtBlockOpInit(asgNode, dest, src, false);
Expand Down Expand Up @@ -11382,33 +11378,6 @@ void Compiler::impValidateMemoryAccessOpcode(const BYTE* codeAddr, const BYTE* c
}
}

/*****************************************************************************/

#ifdef DEBUG

#undef RETURN // undef contracts RETURN macro

enum controlFlow_t
{
NEXT,
CALL,
RETURN,
THROW,
BRANCH,
COND_BRANCH,
BREAK,
PHI,
META,
};

const static controlFlow_t controlFlow[] = {
#define OPDEF(c, s, pop, push, args, type, l, s1, s2, flow) flow,
#include "opcode.def"
#undef OPDEF
};

#endif // DEBUG

/*****************************************************************************
* Determine the result type of an arithmetic operation
* On 64-bit inserts upcasts when native int is mixed with int32
Expand Down Expand Up @@ -13763,8 +13732,13 @@ void Compiler::impImportBlockCode(BasicBlock* block)
assertImp(genActualType(op1) == genActualType(op2) || (varTypeIsI(op1) && varTypeIsI(op2)) ||
(varTypeIsFloating(op1) && varTypeIsFloating(op2)));

// Create the comparison node.
if ((op1->TypeGet() != op2->TypeGet()) && varTypeIsFloating(op1))
{
op1 = impImplicitR4orR8Cast(op1, TYP_DOUBLE);
op2 = impImplicitR4orR8Cast(op2, TYP_DOUBLE);
}

// Create the comparison node.
op1 = gtNewOperNode(oper, TYP_INT, op1, op2);

// TODO: setting both flags when only one is appropriate.
Expand Down
57 changes: 0 additions & 57 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9360,58 +9360,6 @@ GenTree* Compiler::fgMorphBlockOperand(GenTree* tree, var_types asgType, ClassLa
return effectiveVal;
}

// insert conversions and normalize to make tree amenable to register
// FP architectures
GenTree* Compiler::fgMorphForRegisterFP(GenTree* tree)
{
if (tree->OperIsArithmetic())
{
if (varTypeIsFloating(tree))
{
GenTree* op1 = tree->AsOp()->gtOp1;
GenTree* op2 = tree->gtGetOp2();

assert(varTypeIsFloating(op1->TypeGet()) && varTypeIsFloating(op2->TypeGet()));

if (op1->TypeGet() != tree->TypeGet())
{
tree->AsOp()->gtOp1 = gtNewCastNode(tree->TypeGet(), op1, false, tree->TypeGet());
}
if (op2->TypeGet() != tree->TypeGet())
{
tree->AsOp()->gtOp2 = gtNewCastNode(tree->TypeGet(), op2, false, tree->TypeGet());
}
}
}
else if (tree->OperIsCompare())
{
GenTree* op1 = tree->AsOp()->gtOp1;

if (varTypeIsFloating(op1))
{
GenTree* op2 = tree->gtGetOp2();
assert(varTypeIsFloating(op2));

if (op1->TypeGet() != op2->TypeGet())
{
// both had better be floating, just one bigger than other
if (op1->TypeGet() == TYP_FLOAT)
{
assert(op2->TypeGet() == TYP_DOUBLE);
tree->AsOp()->gtOp1 = gtNewCastNode(TYP_DOUBLE, op1, false, TYP_DOUBLE);
}
else if (op2->TypeGet() == TYP_FLOAT)
{
assert(op1->TypeGet() == TYP_DOUBLE);
tree->AsOp()->gtOp2 = gtNewCastNode(TYP_DOUBLE, op2, false, TYP_DOUBLE);
}
}
}
}

return tree;
}

#ifdef FEATURE_SIMD

//--------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -9797,11 +9745,6 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optA
AssertionIndex thenAssertionCount = DUMMY_INIT(0);
AssertionDsc* thenAssertionTab = DUMMY_INIT(NULL);

if (fgGlobalMorph)
{
tree = fgMorphForRegisterFP(tree);
}

genTreeOps oper = tree->OperGet();
var_types typ = tree->TypeGet();
GenTree* op1 = tree->AsOp()->gtOp1;
Expand Down