Skip to content

Commit f01cd8d

Browse files
Delete dead code (#61533)
* 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.
1 parent 072e876 commit f01cd8d

9 files changed

Lines changed: 7 additions & 292 deletions

File tree

src/coreclr/jit/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ if (CLR_CMAKE_TARGET_WIN32)
230230
regalloc.h
231231
register_arg_convention.h
232232
register.h
233-
reglist.h
234233
regset.h
235234
sideeffects.h
236235
simd.h

src/coreclr/jit/compiler.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9151,10 +9151,6 @@ void cTreeFlags(Compiler* comp, GenTree* tree)
91519151
{
91529152
chars += printf("[RELOP_JMP_USED]");
91539153
}
9154-
if (tree->gtFlags & GTF_RELOP_QMARK)
9155-
{
9156-
chars += printf("[RELOP_QMARK]");
9157-
}
91589154
break;
91599155

91609156
case GT_QMARK:

src/coreclr/jit/compiler.h

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4242
#include "jitexpandarray.h"
4343
#include "tinyarray.h"
4444
#include "valuenum.h"
45-
#include "reglist.h"
4645
#include "jittelemetry.h"
4746
#include "namedintrinsiclist.h"
4847
#ifdef LATE_DISASM
@@ -3453,8 +3452,6 @@ class Compiler
34533452
// before they have been set.)
34543453
bool gtComplexityExceeds(GenTree** tree, unsigned limit);
34553454

3456-
bool gtCompareTree(GenTree* op1, GenTree* op2);
3457-
34583455
GenTree* gtReverseCond(GenTree* tree);
34593456

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

3644-
#ifdef DEBUG
3645-
static fgWalkPreFn gtAssertColonCond;
3646-
#endif
36473641
static fgWalkPreFn gtMarkColonCond;
36483642
static fgWalkPreFn gtClearColonCond;
36493643

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

3813-
#ifdef TARGET_ARM
3814-
// On architectures whose ABIs allow structs to be passed in registers, struct promotion will sometimes
3815-
// require us to "rematerialize" a struct from it's separate constituent field variables. Packing several sub-word
3816-
// field variables into an argument register is a hard problem. It's easier to reserve a word of memory into which
3817-
// such field can be copied, after which the assembled memory word can be read into the register. We will allocate
3818-
// this variable to be this scratch word whenever struct promotion occurs.
3819-
unsigned lvaPromotedStructAssemblyScratchVar;
3820-
#endif // TARGET_ARM
3821-
38223807
#if defined(DEBUG) && defined(TARGET_XARCH)
38233808

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

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

8025-
bool IsSuperPMIException(unsigned code)
8026-
{
8027-
// Copied from NDP\clr\src\ToolBox\SuperPMI\SuperPMI-Shared\ErrorHandling.h
8028-
8029-
const unsigned EXCEPTIONCODE_DebugBreakorAV = 0xe0421000;
8030-
const unsigned EXCEPTIONCODE_MC = 0xe0422000;
8031-
const unsigned EXCEPTIONCODE_LWM = 0xe0423000;
8032-
const unsigned EXCEPTIONCODE_SASM = 0xe0424000;
8033-
const unsigned EXCEPTIONCODE_SSYM = 0xe0425000;
8034-
const unsigned EXCEPTIONCODE_CALLUTILS = 0xe0426000;
8035-
const unsigned EXCEPTIONCODE_TYPEUTILS = 0xe0427000;
8036-
const unsigned EXCEPTIONCODE_ASSERT = 0xe0440000;
8037-
8038-
switch (code)
8039-
{
8040-
case EXCEPTIONCODE_DebugBreakorAV:
8041-
case EXCEPTIONCODE_MC:
8042-
case EXCEPTIONCODE_LWM:
8043-
case EXCEPTIONCODE_SASM:
8044-
case EXCEPTIONCODE_SSYM:
8045-
case EXCEPTIONCODE_CALLUTILS:
8046-
case EXCEPTIONCODE_TYPEUTILS:
8047-
case EXCEPTIONCODE_ASSERT:
8048-
return true;
8049-
default:
8050-
return false;
8051-
}
8052-
}
8053-
80548010
const char* eeGetMethodName(CORINFO_METHOD_HANDLE hnd, const char** className);
80558011
const char* eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd);
80568012
unsigned compMethodHash(CORINFO_METHOD_HANDLE methodHandle);
@@ -8288,7 +8244,6 @@ class Compiler
82888244
static CORINFO_METHOD_HANDLE eeFindHelper(unsigned helper);
82898245
static CorInfoHelpFunc eeGetHelperNum(CORINFO_METHOD_HANDLE method);
82908246

8291-
static fgWalkPreFn CountSharedStaticHelper;
82928247
static bool IsSharedStaticHelper(GenTree* tree);
82938248
static bool IsGcSafePoint(GenTree* tree);
82948249

src/coreclr/jit/compiler.hpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3617,17 +3617,6 @@ inline CorInfoHelpFunc Compiler::eeGetHelperNum(CORINFO_METHOD_HANDLE method)
36173617
return ((CorInfoHelpFunc)(((size_t)method) >> 2));
36183618
}
36193619

3620-
inline Compiler::fgWalkResult Compiler::CountSharedStaticHelper(GenTree** pTree, fgWalkData* data)
3621-
{
3622-
if (Compiler::IsSharedStaticHelper(*pTree))
3623-
{
3624-
int* pCount = (int*)data->pCallbackData;
3625-
(*pCount)++;
3626-
}
3627-
3628-
return WALK_CONTINUE;
3629-
}
3630-
36313620
// TODO-Cleanup: Replace calls to IsSharedStaticHelper with new HelperCallProperties
36323621
//
36333622

src/coreclr/jit/gentree.cpp

Lines changed: 6 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -5972,8 +5972,7 @@ GenTree* Compiler::gtNewOperNode(genTreeOps oper, var_types type, GenTree* op1,
59725972

59735973
GenTreeQmark* Compiler::gtNewQmarkNode(var_types type, GenTree* cond, GenTreeColon* colon)
59745974
{
5975-
compQmarkUsed = true;
5976-
cond->gtFlags |= GTF_RELOP_QMARK;
5975+
compQmarkUsed = true;
59775976
GenTreeQmark* result = new (this, GT_QMARK) GenTreeQmark(type, cond, colon);
59785977
#ifdef DEBUG
59795978
if (compQmarkRationalized)
@@ -8150,18 +8149,6 @@ GenTree* Compiler::gtCloneExpr(
81508149
/* GTF_NODE_MASK should not be propagated from 'tree' to 'copy' */
81518150
addFlags &= ~GTF_NODE_MASK;
81528151
#endif
8153-
// Some other flags depend on the context of the expression, and should not be preserved.
8154-
// For example, GTF_RELOP_QMARK:
8155-
if (copy->OperKind() & GTK_RELOP)
8156-
{
8157-
addFlags &= ~GTF_RELOP_QMARK;
8158-
}
8159-
// On the other hand, if we're creating such a context, restore this flag.
8160-
if (copy->OperGet() == GT_QMARK)
8161-
{
8162-
copy->AsOp()->gtOp1->gtFlags |= GTF_RELOP_QMARK;
8163-
}
8164-
81658152
copy->gtFlags |= addFlags;
81668153

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

8239-
#if !FEATURE_FIXED_OUT_ARGS
8240-
copy->regArgList = tree->regArgList;
8241-
copy->regArgListCount = tree->regArgListCount;
8242-
#endif
8243-
82448226
// The call sig comes from the EE and doesn't change throughout the compilation process, meaning
82458227
// we only really need one physical copy of it. Therefore a shallow pointer copy will suffice.
82468228
// (Note that this still holds even if the tree we are cloning was created by an inlinee compiler,
@@ -8651,83 +8633,6 @@ Compiler::fgWalkResult Compiler::fgUpdateSideEffectsPost(GenTree** pTree, fgWalk
86518633
return WALK_CONTINUE;
86528634
}
86538635

8654-
/*****************************************************************************
8655-
*
8656-
* Compares two trees and returns true when both trees are the same.
8657-
* Instead of fully comparing the two trees this method can just return false.
8658-
* Thus callers should not assume that the trees are different when false is returned.
8659-
* Only when true is returned can the caller perform code optimizations.
8660-
* The current implementation only compares a limited set of LEAF/CONST node
8661-
* and returns false for all othere trees.
8662-
*/
8663-
bool Compiler::gtCompareTree(GenTree* op1, GenTree* op2)
8664-
{
8665-
/* Make sure that both trees are of the same GT node kind */
8666-
if (op1->OperGet() != op2->OperGet())
8667-
{
8668-
return false;
8669-
}
8670-
8671-
/* Make sure that both trees are returning the same type */
8672-
if (op1->gtType != op2->gtType)
8673-
{
8674-
return false;
8675-
}
8676-
8677-
/* Figure out what kind of a node we have */
8678-
8679-
genTreeOps oper = op1->OperGet();
8680-
unsigned kind = op1->OperKind();
8681-
8682-
/* Is this a constant or leaf node? */
8683-
8684-
if (kind & (GTK_CONST | GTK_LEAF))
8685-
{
8686-
switch (oper)
8687-
{
8688-
case GT_CNS_INT:
8689-
if ((op1->AsIntCon()->gtIconVal == op2->AsIntCon()->gtIconVal) && GenTree::SameIconHandleFlag(op1, op2))
8690-
{
8691-
return true;
8692-
}
8693-
break;
8694-
8695-
case GT_CNS_LNG:
8696-
if (op1->AsLngCon()->gtLconVal == op2->AsLngCon()->gtLconVal)
8697-
{
8698-
return true;
8699-
}
8700-
break;
8701-
8702-
case GT_CNS_STR:
8703-
if (op1->AsStrCon()->gtSconCPX == op2->AsStrCon()->gtSconCPX)
8704-
{
8705-
return true;
8706-
}
8707-
break;
8708-
8709-
case GT_LCL_VAR:
8710-
if (op1->AsLclVarCommon()->GetLclNum() == op2->AsLclVarCommon()->GetLclNum())
8711-
{
8712-
return true;
8713-
}
8714-
break;
8715-
8716-
case GT_CLS_VAR:
8717-
if (op1->AsClsVar()->gtClsVarHnd == op2->AsClsVar()->gtClsVarHnd)
8718-
{
8719-
return true;
8720-
}
8721-
break;
8722-
8723-
default:
8724-
// we return false for these unhandled 'oper' kinds
8725-
break;
8726-
}
8727-
}
8728-
return false;
8729-
}
8730-
87318636
//------------------------------------------------------------------------
87328637
// gtGetThisArg: Return this pointer node for the call.
87338638
//
@@ -8759,28 +8664,6 @@ GenTree* Compiler::gtGetThisArg(GenTreeCall* call)
87598664
// Assert if we used DEBUG_DESTROY_NODE.
87608665
assert(result->gtOper != GT_COUNT);
87618666

8762-
#if !FEATURE_FIXED_OUT_ARGS && defined(DEBUG)
8763-
// Check that call->fgArgInfo used in gtArgEntryByArgNum was not
8764-
// left outdated by assertion propogation updates.
8765-
// There is no information about registers of late args for platforms
8766-
// with FEATURE_FIXED_OUT_ARGS that is why this debug check is under
8767-
// !FEATURE_FIXED_OUT_ARGS.
8768-
regNumber thisReg = REG_ARG_0;
8769-
regList list = call->regArgList;
8770-
int index = 0;
8771-
for (GenTreeCall::Use& use : call->LateArgs())
8772-
{
8773-
assert(index < call->regArgListCount);
8774-
regNumber curArgReg = list[index];
8775-
if (curArgReg == thisReg)
8776-
{
8777-
assert(result == use.GetNode());
8778-
}
8779-
8780-
index++;
8781-
}
8782-
#endif // !FEATURE_FIXED_OUT_ARGS && defined(DEBUG)
8783-
87848667
return result;
87858668
}
87868669

@@ -10478,12 +10361,6 @@ void Compiler::gtDispNode(GenTree* tree, IndentStack* indentStack, __in __in_z _
1047810361
--msgLength;
1047910362
break;
1048010363
}
10481-
if (tree->gtFlags & GTF_RELOP_QMARK)
10482-
{
10483-
printf("Q");
10484-
--msgLength;
10485-
break;
10486-
}
1048710364
goto DASH;
1048810365

1048910366
case GT_JCMP:
@@ -10866,12 +10743,6 @@ void Compiler::gtGetLclVarNameInfo(unsigned lclNum, const char** ilKindOut, cons
1086610743
ilName = "OutArgs";
1086710744
}
1086810745
#endif // FEATURE_FIXED_OUT_ARGS
10869-
#ifdef TARGET_ARM
10870-
else if (lclNum == lvaPromotedStructAssemblyScratchVar)
10871-
{
10872-
ilName = "PromotedStructScratch";
10873-
}
10874-
#endif // TARGET_ARM
1087510746
#if !defined(FEATURE_EH_FUNCLETS)
1087610747
else if (lclNum == lvaShadowSPslotsVar)
1087710748
{
@@ -12045,9 +11916,6 @@ void Compiler::gtDispTree(GenTree* tree,
1204511916
(call->gtControlExpr == lastChild) ? IIArcBottom : IIArc, "control expr", topOnly);
1204611917
}
1204711918

12048-
#if !FEATURE_FIXED_OUT_ARGS
12049-
regList list = call->regArgList;
12050-
#endif
1205111919
int lateArgIndex = 0;
1205211920
for (GenTreeCall::Use& use : call->LateArgs())
1205311921
{
@@ -12226,10 +12094,7 @@ void Compiler::gtGetLateArgMsg(GenTreeCall* call, GenTree* argx, int lateArgInde
1222612094
assert(curArgTabEntry);
1222712095
regNumber argReg = curArgTabEntry->GetRegNum();
1222812096

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

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

1299912864
return compare;
1300012865
}
@@ -13034,7 +12899,7 @@ GenTree* Compiler::gtFoldTypeCompare(GenTree* tree)
1303412899
GenTree* compare = gtCreateHandleCompare(oper, arg1, arg2, inliningKind);
1303512900

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

1303912904
return compare;
1304012905
}
@@ -13132,7 +12997,7 @@ GenTree* Compiler::gtFoldTypeCompare(GenTree* tree)
1313212997
GenTree* const compare = gtCreateHandleCompare(oper, objMT, knownMT, typeCheckInliningResult);
1313312998

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

1313713002
// And we're done
1313813003
return compare;
@@ -15928,7 +15793,6 @@ void Compiler::gtExtractSideEffList(GenTree* expr,
1592815793
*/
1592915794

1593015795
#ifdef DEBUG
15931-
1593215796
void dispNodeList(GenTree* list, bool verbose)
1593315797
{
1593415798
GenTree* last = nullptr;
@@ -15962,21 +15826,7 @@ void dispNodeList(GenTree* list, bool verbose)
1596215826
}
1596315827
printf(""); // null string means flush
1596415828
}
15965-
15966-
/*****************************************************************************
15967-
* Callback to assert that the nodes of a qmark-colon subtree are marked
15968-
*/
15969-
15970-
/* static */
15971-
Compiler::fgWalkResult Compiler::gtAssertColonCond(GenTree** pTree, fgWalkData* data)
15972-
{
15973-
assert(data->pCallbackData == nullptr);
15974-
15975-
assert((*pTree)->gtFlags & GTF_COLON_COND);
15976-
15977-
return WALK_CONTINUE;
15978-
}
15979-
#endif // DEBUG
15829+
#endif
1598015830

1598115831
/*****************************************************************************
1598215832
* Callback to mark the nodes of a qmark-colon subtree that are conditionally

0 commit comments

Comments
 (0)