summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Andreenko <seandree@microsoft.com>2019-03-22 16:33:23 -0700
committerGitHub <noreply@github.com>2019-03-22 16:33:23 -0700
commit017ded3c6acd653b875f4ef12c232617855dea09 (patch)
treeeea6f3ac7a6f5755b4d07e55f6f73a262191e0d1
parent39b1b6338015c9d6ef193986e0579f0ae0e60566 (diff)
downloadcoreclr-017ded3c6acd653b875f4ef12c232617855dea09.tar.gz
coreclr-017ded3c6acd653b875f4ef12c232617855dea09.tar.bz2
coreclr-017ded3c6acd653b875f4ef12c232617855dea09.zip
Delete unused variables in jit. Part1. (#23399)
* Clean `assertionprop.cpp`. * Clean `codegencommon.cpp`.: * Clean `codegenlinear.cpp`. * Clean `compiler.cpp`. * Clean `earlyprop.cpp`. * Clean `gschecks.cpp`. * Clean 'lclvars.cpp`. * Clean `jiteh.cpp`. * Clean `liveness.cpp`. * Clean `hashbv.cpp`. * Clean `gcinfo.cpp`. * Clean `optimizer.cpp`.
-rw-r--r--src/jit/assertionprop.cpp13
-rw-r--r--src/jit/codegencommon.cpp7
-rw-r--r--src/jit/codegenlinear.cpp7
-rw-r--r--src/jit/compiler.cpp30
-rw-r--r--src/jit/earlyprop.cpp1
-rw-r--r--src/jit/gcinfo.cpp2
-rw-r--r--src/jit/gschecks.cpp1
-rw-r--r--src/jit/hashbv.cpp14
-rw-r--r--src/jit/jiteh.cpp7
-rw-r--r--src/jit/lclvars.cpp12
-rw-r--r--src/jit/liveness.cpp2
-rw-r--r--src/jit/optimizer.cpp2
12 files changed, 24 insertions, 74 deletions
diff --git a/src/jit/assertionprop.cpp b/src/jit/assertionprop.cpp
index 1ee56b22d6..3747b2edca 100644
--- a/src/jit/assertionprop.cpp
+++ b/src/jit/assertionprop.cpp
@@ -453,9 +453,6 @@ void Compiler::optAddCopies()
noway_assert(tree && op1 && tree->OperIs(GT_ASG) && (op1->gtOper == GT_LCL_VAR) &&
(op1->gtLclVarCommon.gtLclNum == lclNum));
- /* TODO-Review: BB_UNITY_WEIGHT is not the correct block weight */
- unsigned blockWeight = BB_UNITY_WEIGHT;
-
/* Assign the old expression into the new temp */
GenTree* newAsgn = gtNewTempAssign(copyLclNum, tree->gtOp.gtOp2);
@@ -1309,7 +1306,6 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
{
unsigned lclNum = op1->gtLclVarCommon.gtLclNum;
noway_assert(lclNum < lvaCount);
- LclVarDsc* lclVar = &lvaTable[lclNum];
// If the local variable is not in SSA then bail
if (!lvaInSsa(lclNum))
@@ -2203,8 +2199,6 @@ AssertionIndex Compiler::optFindComplementary(AssertionIndex assertIndex)
return index;
}
- optAssertionKind complementaryAssertionKind =
- (inputAssertion->assertionKind == OAK_EQUAL) ? OAK_NOT_EQUAL : OAK_EQUAL;
for (AssertionIndex index = 1; index <= optAssertionCount; ++index)
{
// Make sure assertion kinds are complementary and op1, op2 kinds match.
@@ -2404,8 +2398,7 @@ GenTree* Compiler::optVNConstantPropOnTree(BasicBlock* block, GenTree* stmt, Gen
return nullptr;
}
- GenTree* newTree = tree;
- GenTree* sideEffList = nullptr;
+ GenTree* newTree = tree;
switch (vnStore->TypeOfVN(vnCns))
{
case TYP_FLOAT:
@@ -3540,8 +3533,6 @@ GenTree* Compiler::optAssertionProp_Ind(ASSERT_VALARG_TP assertions, GenTree* tr
return nullptr;
}
- unsigned lclNum = op1->gtLclVarCommon.gtLclNum;
-
#ifdef DEBUG
bool vnBased = false;
AssertionIndex index = NO_ASSERTION_INDEX;
@@ -4437,7 +4428,6 @@ private:
ASSERT_TP* mJumpDestOut;
ASSERT_TP* mJumpDestGen;
- Compiler* m_pCompiler;
BitVecTraits* apTraits;
public:
@@ -4446,7 +4436,6 @@ public:
, preMergeJumpDestOut(BitVecOps::UninitVal())
, mJumpDestOut(jumpDestOut)
, mJumpDestGen(jumpDestGen)
- , m_pCompiler(pCompiler)
, apTraits(pCompiler->apTraits)
{
}
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 2e15383025..9efa517edb 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -2339,7 +2339,6 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode)
if (compiler->opts.dmpHex)
{
size_t consSize = getEmitter()->emitDataSize();
- size_t infoSize = compiler->compInfoBlkSize;
fprintf(dmpf, "Generated code for %s:\n", compiler->info.compFullName);
fprintf(dmpf, "\n");
@@ -2353,6 +2352,7 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode)
fprintf(dmpf, " Const at %p [%04X bytes]\n", dspPtr(consPtr), consSize);
}
#ifdef JIT32_GCENCODER
+ size_t infoSize = compiler->compInfoBlkSize;
if (infoSize)
fprintf(dmpf, " Info at %p [%04X bytes]\n", dspPtr(infoPtr), infoSize);
#endif // JIT32_GCENCODER
@@ -6080,9 +6080,8 @@ void CodeGen::genZeroInitFrame(int untrLclHi, int untrLclLo, regNumber initReg,
#else // !define(_TARGET_ARM_)
- regNumber rZero1 = REG_ZR;
- rAddr = initReg;
- *pInitRegZeroed = false;
+ rAddr = initReg;
+ *pInitRegZeroed = false;
#endif // !defined(_TARGET_ARM_)
diff --git a/src/jit/codegenlinear.cpp b/src/jit/codegenlinear.cpp
index 595f86016e..7c5c01895e 100644
--- a/src/jit/codegenlinear.cpp
+++ b/src/jit/codegenlinear.cpp
@@ -1147,7 +1147,7 @@ void CodeGen::genConsumeRegAndCopy(GenTree* node, regNumber needReg)
{
return;
}
- regNumber treeReg = genConsumeReg(node);
+ genConsumeReg(node);
genCopyRegIfNeeded(node, needReg);
}
@@ -1846,9 +1846,8 @@ void CodeGen::genProduceReg(GenTree* tree)
for (unsigned i = 0; i < regCount; ++i)
{
- var_types type = retTypeDesc->GetReturnRegType(i);
- regNumber fromReg = call->GetRegNumByIdx(i);
- regNumber toReg = copy->GetRegNumByIdx(i);
+ var_types type = retTypeDesc->GetReturnRegType(i);
+ regNumber toReg = copy->GetRegNumByIdx(i);
if (toReg != REG_NA)
{
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 7bb93a299d..a594e23251 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -2711,7 +2711,6 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
bool dumpIRBlockHeaders = false;
bool dumpIRExit = false;
LPCWSTR dumpIRPhase = nullptr;
- LPCWSTR dumpIRFormat = nullptr;
if (!altJitConfig || opts.altJit)
{
@@ -7120,17 +7119,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
void codeGeneratorCodeSizeBeg()
{
}
-/*****************************************************************************/
-
-/*****************************************************************************
- *
- * If any temporary tables are smaller than 'genMinSize2free' we won't bother
- * freeing them.
- */
-
-const size_t genMinSize2free = 64;
-
-/*****************************************************************************/
/*****************************************************************************
*
@@ -7543,7 +7531,6 @@ void CompTimeSummaryInfo::Print(FILE* f)
return;
}
- bool extraInfo = (JitConfig.JitEECallTimingInfo() != 0);
double totTime_ms = 0.0;
fprintf(f, "JIT Compilation time report:\n");
@@ -7563,6 +7550,7 @@ void CompTimeSummaryInfo::Print(FILE* f)
const char* extraHdr1 = "";
const char* extraHdr2 = "";
#if MEASURE_CLRAPI_CALLS
+ bool extraInfo = (JitConfig.JitEECallTimingInfo() != 0);
if (extraInfo)
{
extraHdr1 = " CLRs/meth % in CLR";
@@ -7580,9 +7568,8 @@ void CompTimeSummaryInfo::Print(FILE* f)
assert(_countof(PhaseNames) == PHASE_NUMBER_OF);
for (int i = 0; i < PHASE_NUMBER_OF; i++)
{
- double phase_tot_ms = (((double)m_total.m_cyclesByPhase[i]) / countsPerSec) * 1000.0;
- double phase_max_ms = (((double)m_maximum.m_cyclesByPhase[i]) / countsPerSec) * 1000.0;
- double phase_tot_pct = 100.0 * phase_tot_ms / totTime_ms;
+ double phase_tot_ms = (((double)m_total.m_cyclesByPhase[i]) / countsPerSec) * 1000.0;
+ double phase_max_ms = (((double)m_maximum.m_cyclesByPhase[i]) / countsPerSec) * 1000.0;
#if MEASURE_CLRAPI_CALLS
// Skip showing CLR API call info if we didn't collect any
@@ -10889,15 +10876,8 @@ void cNodeIR(Compiler* comp, GenTree* tree)
void cTreeIR(Compiler* comp, GenTree* tree)
{
- bool foldLeafs = comp->dumpIRNoLeafs;
- bool foldIndirs = comp->dumpIRDataflow;
- bool foldLists = comp->dumpIRNoLists;
- bool dataflowView = comp->dumpIRDataflow;
- bool dumpTypes = comp->dumpIRTypes;
- bool dumpValnums = comp->dumpIRValnums;
- bool noStmts = comp->dumpIRNoStmts;
- genTreeOps op = tree->OperGet();
- unsigned childCount = tree->NumChildren();
+ genTreeOps op = tree->OperGet();
+ unsigned childCount = tree->NumChildren();
GenTree* child;
// Recurse and dump trees that this node depends on.
diff --git a/src/jit/earlyprop.cpp b/src/jit/earlyprop.cpp
index 693294b49c..bd4c222664 100644
--- a/src/jit/earlyprop.cpp
+++ b/src/jit/earlyprop.cpp
@@ -322,7 +322,6 @@ GenTree* Compiler::optEarlyPropRewriteTree(GenTree* tree)
GenTree* comma = check->gtGetParent(nullptr);
if ((comma != nullptr) && comma->OperIs(GT_COMMA) && (comma->gtGetOp1() == check))
{
- GenTree* next = check->gtNext;
optRemoveRangeCheck(comma, compCurStmt);
// Both `tree` and `check` have been removed from the statement.
// 'tree' was replaced with 'nop' or side effect list under 'comma'.
diff --git a/src/jit/gcinfo.cpp b/src/jit/gcinfo.cpp
index 14ca8a873f..3f980ba370 100644
--- a/src/jit/gcinfo.cpp
+++ b/src/jit/gcinfo.cpp
@@ -638,8 +638,6 @@ void GCInfo::gcRegPtrSetInit()
GCInfo::WriteBarrierForm GCInfo::gcWriteBarrierFormFromTargetAddress(GenTree* tgtAddr)
{
- GCInfo::WriteBarrierForm result = GCInfo::WBF_BarrierUnknown; // Default case, we have no information.
-
// If we store through an int to a GC_REF field, we'll assume that needs to use a checked barriers.
if (tgtAddr->TypeGet() == TYP_I_IMPL)
{
diff --git a/src/jit/gschecks.cpp b/src/jit/gschecks.cpp
index 8fe14b9d9d..e52817a269 100644
--- a/src/jit/gschecks.cpp
+++ b/src/jit/gschecks.cpp
@@ -105,7 +105,6 @@ Compiler::fgWalkResult Compiler::gsMarkPtrsAndAssignGroups(GenTree** pTree, fgWa
GenTree* tree = *pTree;
ShadowParamVarInfo* shadowVarInfo = pState->comp->gsShadowVarInfo;
assert(shadowVarInfo);
- bool fIsBlk = false;
unsigned lclNum;
assert(!pState->isAssignSrc || pState->lvAssignDef != (unsigned)-1);
diff --git a/src/jit/hashbv.cpp b/src/jit/hashbv.cpp
index 6aee93ee33..5539baa2ca 100644
--- a/src/jit/hashbv.cpp
+++ b/src/jit/hashbv.cpp
@@ -426,8 +426,6 @@ hashBv*& hashBv::hbvFreeList(hashBvGlobalData* data)
void hashBv::hbvFree()
{
- Compiler* comp = this->compiler;
-
int hts = hashtable_size();
for (int i = 0; i < hts; i++)
{
@@ -571,8 +569,6 @@ void hashBv::Resize(int newSize)
}
else if (oldSize > newSize)
{
- int shrinkFactor = oldSize / newSize;
-
// shrink multiple lists into one list
// more efficient ways to do this but...
// if the lists are long, you shouldn't be shrinking.
@@ -922,8 +918,6 @@ int hashBv::countBits()
bool hashBv::anySet()
{
- int result = 0;
-
int hts = this->hashtable_size();
for (int hashNum = 0; hashNum < hts; hashNum++)
{
@@ -1299,7 +1293,6 @@ bool hashBv::MultiTraverseLHSBigger(hashBv* other)
hashBvNode* o = other->nodeArr[h];
while (o)
{
- hashBvNode* next = o->next;
// figure out what dst list this goes to
int hash = getHashForIndex(o->baseIndex, hts);
int dstIndex = (hash - h) >> other->log2_hashSize;
@@ -1359,7 +1352,6 @@ bool hashBv::MultiTraverseLHSBigger(hashBv* other)
template <typename Action>
bool hashBv::MultiTraverseRHSBigger(hashBv* other)
{
- int hts = this->hashtable_size();
int ots = other->hashtable_size();
bool result = Action::DefaultResult();
@@ -1459,8 +1451,6 @@ bool hashBv::MultiTraverseEqual(hashBv* other)
for (int hashNum = 0; hashNum < hts; hashNum++)
{
- int destination = getHashForIndex(BITS_PER_NODE * hashNum, this->hashtable_size());
-
hashBvNode** pa = &this->nodeArr[hashNum];
hashBvNode** pb = &other->nodeArr[hashNum];
hashBvNode* b = *pb;
@@ -1520,8 +1510,6 @@ bool hashBv::MultiTraverseEqual(hashBv* other)
template <class Action>
bool hashBv::MultiTraverse(hashBv* other)
{
- bool result = false;
-
assert(this->numNodes == this->getNodeCount());
Action::PreAction(this, other);
@@ -1646,8 +1634,6 @@ void hashBv::copyFrom(hashBv* other, Compiler* comp)
while (otherNode)
{
// printf("otherNode is True...\n");
- hashBvNode* next = *splicePoint;
-
this->numNodes++;
if (freeList)
diff --git a/src/jit/jiteh.cpp b/src/jit/jiteh.cpp
index bf476980fa..5179dd23dc 100644
--- a/src/jit/jiteh.cpp
+++ b/src/jit/jiteh.cpp
@@ -907,8 +907,6 @@ void Compiler::ehGetCallFinallyBlockRange(unsigned finallyIndex, BasicBlock** be
assert(begBlk != nullptr);
assert(endBlk != nullptr);
- EHblkDsc* ehDsc = ehGetDsc(finallyIndex);
-
#if FEATURE_EH_CALLFINALLY_THUNKS
bool inTryRegion;
unsigned callFinallyRegionIndex = ehGetCallFinallyRegionIndex(finallyIndex, &inTryRegion);
@@ -934,8 +932,9 @@ void Compiler::ehGetCallFinallyBlockRange(unsigned finallyIndex, BasicBlock** be
}
}
#else // !FEATURE_EH_CALLFINALLY_THUNKS
- *begBlk = ehDsc->ebdTryBeg;
- *endBlk = ehDsc->ebdTryLast->bbNext;
+ EHblkDsc* ehDsc = ehGetDsc(finallyIndex);
+ *begBlk = ehDsc->ebdTryBeg;
+ *endBlk = ehDsc->ebdTryLast->bbNext;
#endif // !FEATURE_EH_CALLFINALLY_THUNKS
}
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index d4916cbf86..722e18f452 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -550,7 +550,10 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo* varDscInfo)
const unsigned argSigLen = info.compMethodInfo->args.numArgs;
+#ifdef _TARGET_ARM_
regMaskTP doubleAlignMask = RBM_NONE;
+#endif // _TARGET_ARM_
+
for (unsigned i = 0; i < argSigLen;
i++, varDscInfo->varNum++, varDscInfo->varDsc++, argLst = info.compCompHnd->getArgNext(argLst))
{
@@ -569,8 +572,12 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo* varDscInfo)
}
// For ARM, ARM64, and AMD64 varargs, all arguments go in integer registers
- var_types argType = mangleVarArgsType(varDsc->TypeGet());
+ var_types argType = mangleVarArgsType(varDsc->TypeGet());
+
+#ifdef _TARGET_ARM_
var_types origArgType = argType;
+#endif // TARGET_ARM
+
// ARM softfp calling convention should affect only the floating point arguments.
// Otherwise there appear too many surplus pre-spills and other memory operations
// with the associated locations .
@@ -1992,8 +1999,6 @@ bool Compiler::StructPromotionHelper::TryPromoteStructField(lvaStructFieldInfo&
return false;
}
- COMP_HANDLE compHandl = compiler->info.compCompHnd;
-
// Do not promote if the single field is not aligned at its natural boundary within
// the struct field.
CORINFO_FIELD_HANDLE innerFieldHndl = compHandle->getFieldInClass(fieldInfo.fldTypeHnd, 0);
@@ -2451,7 +2456,6 @@ void Compiler::lvaSetStruct(unsigned varNum, CORINFO_CLASS_HANDLE typeHnd, bool
}
// Set the type and associated info if we haven't already set it.
- var_types structType = varDsc->lvType;
if (varDsc->lvType == TYP_UNDEF)
{
varDsc->lvType = TYP_STRUCT;
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp
index c9d5452427..2fb225ebab 100644
--- a/src/jit/liveness.cpp
+++ b/src/jit/liveness.cpp
@@ -955,7 +955,6 @@ void Compiler::fgExtendDbgLifetimes()
VarSetOps::DiffD(this, initVars, block->bbLiveIn);
/* Add statements initializing the vars, if there are any to initialize */
- unsigned blockWeight = block->getBBWeight(this);
VarSetOps::Iter iter(this, initVars);
unsigned varIndex = 0;
@@ -1001,6 +1000,7 @@ void Compiler::fgExtendDbgLifetimes()
initRange.InsertBefore(nullptr, zero, store);
#if !defined(_TARGET_64BIT_)
+ unsigned blockWeight = block->getBBWeight(this);
DecomposeLongs::DecomposeRange(this, blockWeight, initRange);
#endif // !defined(_TARGET_64BIT_)
m_pLowering->LowerRange(block, initRange);
diff --git a/src/jit/optimizer.cpp b/src/jit/optimizer.cpp
index 795625aaf2..0be4456d8d 100644
--- a/src/jit/optimizer.cpp
+++ b/src/jit/optimizer.cpp
@@ -7915,8 +7915,6 @@ void Compiler::optRemoveRangeCheck(GenTree* tree, GenTree* stmt)
noway_assert(bndsChkTree->OperIsBoundsCheck());
- GenTreeBoundsChk* bndsChk = tree->gtOp.gtOp1->AsBoundsChk();
-
#ifdef DEBUG
if (verbose)
{