Skip to content

Commit

Permalink
Delete dead code (#61533)
Browse files Browse the repository at this point in the history
* Delete regArgList

Unused.

* Delete CountSharedStaticHelper

Unused.

* Delete GTF_RELOP_QMARK

Unused.

* Delete lvaPromotedStructAssemblyScratchVar

Unused.

* Delete dead code from fgMorphSmpOp

The conditions tested constitute invalid IR.

* Delete gtCompareTree

Unused.

* Delete gtAssertColonCond

Unused.

* Delete IsSuperPMIException

Unused.
  • Loading branch information
SingleAccretion authored Nov 15, 2021
1 parent 072e876 commit f01cd8d
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 292 deletions.
1 change: 0 additions & 1 deletion src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ if (CLR_CMAKE_TARGET_WIN32)
regalloc.h
register_arg_convention.h
register.h
reglist.h
regset.h
sideeffects.h
simd.h
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 @@ -9151,10 +9151,6 @@ void cTreeFlags(Compiler* comp, GenTree* tree)
{
chars += printf("[RELOP_JMP_USED]");
}
if (tree->gtFlags & GTF_RELOP_QMARK)
{
chars += printf("[RELOP_QMARK]");
}
break;

case GT_QMARK:
Expand Down
45 changes: 0 additions & 45 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include "jitexpandarray.h"
#include "tinyarray.h"
#include "valuenum.h"
#include "reglist.h"
#include "jittelemetry.h"
#include "namedintrinsiclist.h"
#ifdef LATE_DISASM
Expand Down Expand Up @@ -3453,8 +3452,6 @@ class Compiler
// before they have been set.)
bool gtComplexityExceeds(GenTree** tree, unsigned limit);

bool gtCompareTree(GenTree* op1, GenTree* op2);

GenTree* gtReverseCond(GenTree* tree);

bool gtHasRef(GenTree* tree, ssize_t lclNum, bool defOnly);
Expand Down Expand Up @@ -3641,9 +3638,6 @@ class Compiler
typedef fgWalkResult(fgWalkPreFn)(GenTree** pTree, fgWalkData* data);
typedef fgWalkResult(fgWalkPostFn)(GenTree** pTree, fgWalkData* data);

#ifdef DEBUG
static fgWalkPreFn gtAssertColonCond;
#endif
static fgWalkPreFn gtMarkColonCond;
static fgWalkPreFn gtClearColonCond;

Expand Down Expand Up @@ -3810,15 +3804,6 @@ class Compiler
// where it is used to detect tail-call chains.
unsigned lvaRetAddrVar;

#ifdef TARGET_ARM
// On architectures whose ABIs allow structs to be passed in registers, struct promotion will sometimes
// require us to "rematerialize" a struct from it's separate constituent field variables. Packing several sub-word
// field variables into an argument register is a hard problem. It's easier to reserve a word of memory into which
// such field can be copied, after which the assembled memory word can be read into the register. We will allocate
// this variable to be this scratch word whenever struct promotion occurs.
unsigned lvaPromotedStructAssemblyScratchVar;
#endif // TARGET_ARM

#if defined(DEBUG) && defined(TARGET_XARCH)

unsigned lvaReturnSpCheck; // Stores SP to confirm it is not corrupted on return.
Expand Down Expand Up @@ -8022,35 +8007,6 @@ class Compiler

#if defined(DEBUG) || defined(FEATURE_JIT_METHOD_PERF) || defined(FEATURE_SIMD) || defined(TRACK_LSRA_STATS)

bool IsSuperPMIException(unsigned code)
{
// Copied from NDP\clr\src\ToolBox\SuperPMI\SuperPMI-Shared\ErrorHandling.h

const unsigned EXCEPTIONCODE_DebugBreakorAV = 0xe0421000;
const unsigned EXCEPTIONCODE_MC = 0xe0422000;
const unsigned EXCEPTIONCODE_LWM = 0xe0423000;
const unsigned EXCEPTIONCODE_SASM = 0xe0424000;
const unsigned EXCEPTIONCODE_SSYM = 0xe0425000;
const unsigned EXCEPTIONCODE_CALLUTILS = 0xe0426000;
const unsigned EXCEPTIONCODE_TYPEUTILS = 0xe0427000;
const unsigned EXCEPTIONCODE_ASSERT = 0xe0440000;

switch (code)
{
case EXCEPTIONCODE_DebugBreakorAV:
case EXCEPTIONCODE_MC:
case EXCEPTIONCODE_LWM:
case EXCEPTIONCODE_SASM:
case EXCEPTIONCODE_SSYM:
case EXCEPTIONCODE_CALLUTILS:
case EXCEPTIONCODE_TYPEUTILS:
case EXCEPTIONCODE_ASSERT:
return true;
default:
return false;
}
}

const char* eeGetMethodName(CORINFO_METHOD_HANDLE hnd, const char** className);
const char* eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd);
unsigned compMethodHash(CORINFO_METHOD_HANDLE methodHandle);
Expand Down Expand Up @@ -8288,7 +8244,6 @@ class Compiler
static CORINFO_METHOD_HANDLE eeFindHelper(unsigned helper);
static CorInfoHelpFunc eeGetHelperNum(CORINFO_METHOD_HANDLE method);

static fgWalkPreFn CountSharedStaticHelper;
static bool IsSharedStaticHelper(GenTree* tree);
static bool IsGcSafePoint(GenTree* tree);

Expand Down
11 changes: 0 additions & 11 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3617,17 +3617,6 @@ inline CorInfoHelpFunc Compiler::eeGetHelperNum(CORINFO_METHOD_HANDLE method)
return ((CorInfoHelpFunc)(((size_t)method) >> 2));
}

inline Compiler::fgWalkResult Compiler::CountSharedStaticHelper(GenTree** pTree, fgWalkData* data)
{
if (Compiler::IsSharedStaticHelper(*pTree))
{
int* pCount = (int*)data->pCallbackData;
(*pCount)++;
}

return WALK_CONTINUE;
}

// TODO-Cleanup: Replace calls to IsSharedStaticHelper with new HelperCallProperties
//

Expand Down
162 changes: 6 additions & 156 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5972,8 +5972,7 @@ GenTree* Compiler::gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1,

GenTreeQmark* Compiler::gtNewQmarkNode(var_types type, GenTree* cond, GenTreeColon* colon)
{
compQmarkUsed = true;
cond->gtFlags |= GTF_RELOP_QMARK;
compQmarkUsed = true;
GenTreeQmark* result = new (this, GT_QMARK) GenTreeQmark(type, cond, colon);
#ifdef DEBUG
if (compQmarkRationalized)
Expand Down Expand Up @@ -8150,18 +8149,6 @@ GenTree* Compiler::gtCloneExpr(
/* GTF_NODE_MASK should not be propagated from 'tree' to 'copy' */
addFlags &= ~GTF_NODE_MASK;
#endif
// Some other flags depend on the context of the expression, and should not be preserved.
// For example, GTF_RELOP_QMARK:
if (copy->OperKind() & GTK_RELOP)
{
addFlags &= ~GTF_RELOP_QMARK;
}
// On the other hand, if we're creating such a context, restore this flag.
if (copy->OperGet() == GT_QMARK)
{
copy->AsOp()->gtOp1->gtFlags |= GTF_RELOP_QMARK;
}

copy->gtFlags |= addFlags;

// Update side effect flags since they may be different from the source side effect flags.
Expand Down Expand Up @@ -8236,11 +8223,6 @@ GenTreeCall* Compiler::gtCloneExprCallHelper(GenTreeCall* tree,
argsTail = &((*argsTail)->NextRef());
}

#if !FEATURE_FIXED_OUT_ARGS
copy->regArgList = tree->regArgList;
copy->regArgListCount = tree->regArgListCount;
#endif

// The call sig comes from the EE and doesn't change throughout the compilation process, meaning
// we only really need one physical copy of it. Therefore a shallow pointer copy will suffice.
// (Note that this still holds even if the tree we are cloning was created by an inlinee compiler,
Expand Down Expand Up @@ -8651,83 +8633,6 @@ Compiler::fgWalkResult Compiler::fgUpdateSideEffectsPost(GenTree** pTree, fgWalk
return WALK_CONTINUE;
}

/*****************************************************************************
*
* Compares two trees and returns true when both trees are the same.
* Instead of fully comparing the two trees this method can just return false.
* Thus callers should not assume that the trees are different when false is returned.
* Only when true is returned can the caller perform code optimizations.
* The current implementation only compares a limited set of LEAF/CONST node
* and returns false for all othere trees.
*/
bool Compiler::gtCompareTree(GenTree* op1, GenTree* op2)
{
/* Make sure that both trees are of the same GT node kind */
if (op1->OperGet() != op2->OperGet())
{
return false;
}

/* Make sure that both trees are returning the same type */
if (op1->gtType != op2->gtType)
{
return false;
}

/* Figure out what kind of a node we have */

genTreeOps oper = op1->OperGet();
unsigned kind = op1->OperKind();

/* Is this a constant or leaf node? */

if (kind & (GTK_CONST | GTK_LEAF))
{
switch (oper)
{
case GT_CNS_INT:
if ((op1->AsIntCon()->gtIconVal == op2->AsIntCon()->gtIconVal) && GenTree::SameIconHandleFlag(op1, op2))
{
return true;
}
break;

case GT_CNS_LNG:
if (op1->AsLngCon()->gtLconVal == op2->AsLngCon()->gtLconVal)
{
return true;
}
break;

case GT_CNS_STR:
if (op1->AsStrCon()->gtSconCPX == op2->AsStrCon()->gtSconCPX)
{
return true;
}
break;

case GT_LCL_VAR:
if (op1->AsLclVarCommon()->GetLclNum() == op2->AsLclVarCommon()->GetLclNum())
{
return true;
}
break;

case GT_CLS_VAR:
if (op1->AsClsVar()->gtClsVarHnd == op2->AsClsVar()->gtClsVarHnd)
{
return true;
}
break;

default:
// we return false for these unhandled 'oper' kinds
break;
}
}
return false;
}

//------------------------------------------------------------------------
// gtGetThisArg: Return this pointer node for the call.
//
Expand Down Expand Up @@ -8759,28 +8664,6 @@ GenTree* Compiler::gtGetThisArg(GenTreeCall* call)
// Assert if we used DEBUG_DESTROY_NODE.
assert(result->gtOper != GT_COUNT);

#if !FEATURE_FIXED_OUT_ARGS && defined(DEBUG)
// Check that call->fgArgInfo used in gtArgEntryByArgNum was not
// left outdated by assertion propogation updates.
// There is no information about registers of late args for platforms
// with FEATURE_FIXED_OUT_ARGS that is why this debug check is under
// !FEATURE_FIXED_OUT_ARGS.
regNumber thisReg = REG_ARG_0;
regList list = call->regArgList;
int index = 0;
for (GenTreeCall::Use& use : call->LateArgs())
{
assert(index < call->regArgListCount);
regNumber curArgReg = list[index];
if (curArgReg == thisReg)
{
assert(result == use.GetNode());
}

index++;
}
#endif // !FEATURE_FIXED_OUT_ARGS && defined(DEBUG)

return result;
}

Expand Down Expand Up @@ -10478,12 +10361,6 @@ void Compiler::gtDispNode(GenTree* tree, IndentStack* indentStack, __in __in_z _
--msgLength;
break;
}
if (tree->gtFlags & GTF_RELOP_QMARK)
{
printf("Q");
--msgLength;
break;
}
goto DASH;

case GT_JCMP:
Expand Down Expand Up @@ -10866,12 +10743,6 @@ void Compiler::gtGetLclVarNameInfo(unsigned lclNum, const char** ilKindOut, cons
ilName = "OutArgs";
}
#endif // FEATURE_FIXED_OUT_ARGS
#ifdef TARGET_ARM
else if (lclNum == lvaPromotedStructAssemblyScratchVar)
{
ilName = "PromotedStructScratch";
}
#endif // TARGET_ARM
#if !defined(FEATURE_EH_FUNCLETS)
else if (lclNum == lvaShadowSPslotsVar)
{
Expand Down Expand Up @@ -12045,9 +11916,6 @@ void Compiler::gtDispTree(GenTree* tree,
(call->gtControlExpr == lastChild) ? IIArcBottom : IIArc, "control expr", topOnly);
}

#if !FEATURE_FIXED_OUT_ARGS
regList list = call->regArgList;
#endif
int lateArgIndex = 0;
for (GenTreeCall::Use& use : call->LateArgs())
{
Expand Down Expand Up @@ -12226,10 +12094,7 @@ void Compiler::gtGetLateArgMsg(GenTreeCall* call, GenTree* argx, int lateArgInde
assert(curArgTabEntry);
regNumber argReg = curArgTabEntry->GetRegNum();

#if !FEATURE_FIXED_OUT_ARGS
assert(lateArgIndex < call->regArgListCount);
assert(argReg == call->regArgList[lateArgIndex]);
#else
#if FEATURE_FIXED_OUT_ARGS
if (argReg == REG_STK)
{
sprintf_s(bufp, bufLength, "arg%d in out+%02x%c", curArgTabEntry->argNum, curArgTabEntry->GetByteOffset(), 0);
Expand Down Expand Up @@ -12994,7 +12859,7 @@ GenTree* Compiler::gtFoldTypeCompare(GenTree* tree)
GenTree* compare = gtCreateHandleCompare(oper, op1ClassFromHandle, op2ClassFromHandle, inliningKind);

// Drop any now-irrelvant flags
compare->gtFlags |= tree->gtFlags & (GTF_RELOP_JMP_USED | GTF_RELOP_QMARK | GTF_DONT_CSE);
compare->gtFlags |= tree->gtFlags & (GTF_RELOP_JMP_USED | GTF_DONT_CSE);

return compare;
}
Expand Down Expand Up @@ -13034,7 +12899,7 @@ GenTree* Compiler::gtFoldTypeCompare(GenTree* tree)
GenTree* compare = gtCreateHandleCompare(oper, arg1, arg2, inliningKind);

// Drop any now-irrelvant flags
compare->gtFlags |= tree->gtFlags & (GTF_RELOP_JMP_USED | GTF_RELOP_QMARK | GTF_DONT_CSE);
compare->gtFlags |= tree->gtFlags & (GTF_RELOP_JMP_USED | GTF_DONT_CSE);

return compare;
}
Expand Down Expand Up @@ -13132,7 +12997,7 @@ GenTree* Compiler::gtFoldTypeCompare(GenTree* tree)
GenTree* const compare = gtCreateHandleCompare(oper, objMT, knownMT, typeCheckInliningResult);

// Drop any now irrelevant flags
compare->gtFlags |= tree->gtFlags & (GTF_RELOP_JMP_USED | GTF_RELOP_QMARK | GTF_DONT_CSE);
compare->gtFlags |= tree->gtFlags & (GTF_RELOP_JMP_USED | GTF_DONT_CSE);

// And we're done
return compare;
Expand Down Expand Up @@ -15928,7 +15793,6 @@ void Compiler::gtExtractSideEffList(GenTree* expr,
*/

#ifdef DEBUG

void dispNodeList(GenTree* list, bool verbose)
{
GenTree* last = nullptr;
Expand Down Expand Up @@ -15962,21 +15826,7 @@ void dispNodeList(GenTree* list, bool verbose)
}
printf(""); // null string means flush
}

/*****************************************************************************
* Callback to assert that the nodes of a qmark-colon subtree are marked
*/

/* static */
Compiler::fgWalkResult Compiler::gtAssertColonCond(GenTree** pTree, fgWalkData* data)
{
assert(data->pCallbackData == nullptr);

assert((*pTree)->gtFlags & GTF_COLON_COND);

return WALK_CONTINUE;
}
#endif // DEBUG
#endif

/*****************************************************************************
* Callback to mark the nodes of a qmark-colon subtree that are conditionally
Expand Down
Loading

0 comments on commit f01cd8d

Please sign in to comment.