delete unused local variables from jit sources (#14679)
authorSergey Andreenko <seandree@microsoft.com>
Wed, 25 Oct 2017 06:30:35 +0000 (23:30 -0700)
committerGitHub <noreply@github.com>
Wed, 25 Oct 2017 06:30:35 +0000 (23:30 -0700)
15 files changed:
src/jit/ee_il_dll.cpp
src/jit/eeinterface.cpp
src/jit/emit.cpp
src/jit/flowgraph.cpp
src/jit/gentree.cpp
src/jit/hashbv.cpp
src/jit/importer.cpp
src/jit/liveness.cpp
src/jit/lower.cpp
src/jit/lsra.cpp
src/jit/lsraxarch.cpp
src/jit/morph.cpp
src/jit/optcse.cpp
src/jit/optimizer.cpp
src/jit/utils.cpp

index 822a2b9..73e6cd6 100644 (file)
@@ -327,8 +327,6 @@ void CILJit::clearCache(void)
  */
 BOOL CILJit::isCacheCleanupRequired(void)
 {
-    BOOL doCleanup;
-
     if (g_realJitCompiler != nullptr)
     {
         if (g_realJitCompiler->isCacheCleanupRequired())
index d8db947..5783037 100644 (file)
@@ -103,8 +103,6 @@ const char* Compiler::eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd)
 
     /* figure out the signature */
 
-    EXCEPTION_POINTERS exceptionPointers;
-
     PAL_TRY(FilterSuperPMIExceptionsParam_eeinterface*, pParam, &param)
     {
         unsigned i;
index 31ef44d..f9f3d85 100644 (file)
@@ -1521,10 +1521,6 @@ void emitter::emitEndProlog()
 {
     assert(emitComp->compGeneratingProlog);
 
-    size_t prolSz;
-
-    insGroup* tempIG;
-
     emitNoGCIG = false;
 
     /* Save the prolog IG if non-empty or if only one block */
@@ -7194,7 +7190,6 @@ const char* emitter::emitOffsetToLabel(unsigned offs)
     char*           retbuf;
 
     insGroup*      ig;
-    UNATIVE_OFFSET of;
     UNATIVE_OFFSET nextof = 0;
 
     for (ig = emitIGlist; ig != nullptr; ig = ig->igNext)
index 9efd95b..18ef525 100644 (file)
@@ -21539,7 +21539,6 @@ void Compiler::fgDebugCheckNodeLinks(BasicBlock* block, GenTree* node)
 
         if (tree->OperIsUnary() && tree->gtOp.gtOp1)
         {
-            GenTreePtr lclVarTree;
             expectedPrevTree = tree->gtOp.gtOp1;
         }
         else if (tree->OperIsBinary() && tree->gtOp.gtOp1)
index 04e0c9c..4cd4221 100644 (file)
@@ -3088,8 +3088,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
 
     /* Is this a FP value? */
 
-    bool     isflt = varTypeIsFloating(tree->TypeGet());
-    unsigned FPlvlSave;
+    bool isflt = varTypeIsFloating(tree->TypeGet());
 
     /* Figure out what kind of a node we have */
 
@@ -3103,8 +3102,6 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
     int       costEx;
     int       costSz;
 
-    bool bRngChk;
-
 #ifdef DEBUG
     costEx = -1;
     costSz = -1;
@@ -3943,7 +3940,6 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
                                                 (op2->gtOp.gtOp1->gtOper == GT_MUL &&
                                                  op2->gtOp.gtOp1->gtOp.gtOp1->gtOper == GT_NOP))
                                             {
-                                                // assert(bRngChk);
                                                 op2->gtFlags |= GTF_ADDRMODE_NO_CSE;
                                                 if (op2->gtOp.gtOp1->gtOper == GT_MUL)
                                                 {
@@ -4609,7 +4605,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
             if (tree->gtCall.gtCallArgs)
             {
 #if FEATURE_STACK_FP_X87
-                FPlvlSave = codeGen->genGetFPstkLevel();
+                unsigned FPlvlSave = codeGen->genGetFPstkLevel();
 #endif // FEATURE_STACK_FP_X87
                 const bool isListCallArgs = true;
                 const bool callArgsInRegs = false;
@@ -4633,7 +4629,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree)
             if (tree->gtCall.gtCallLateArgs)
             {
 #if FEATURE_STACK_FP_X87
-                FPlvlSave = codeGen->genGetFPstkLevel();
+                unsigned FPlvlSave = codeGen->genGetFPstkLevel();
 #endif // FEATURE_STACK_FP_X87
                 const bool isListCallArgs = true;
                 const bool callArgsInRegs = true;
@@ -10988,7 +10984,6 @@ void Compiler::gtDispChild(GenTreePtr           child,
                            __in_opt const char* msg,     /* = nullptr  */
                            bool                 topOnly) /* = false */
 {
-    IndentInfo info;
     indentStack->Push(arcType);
     gtDispTree(child, indentStack, msg, topOnly);
     indentStack->Pop();
index fa06ec7..db8dda1 100644 (file)
@@ -549,7 +549,6 @@ void hashBv::Resize(int newSize)
 
     int oldSizeLog2  = log2_hashSize;
     int log2_newSize = genLog2((unsigned)newSize);
-    int size;
 
     hashBvNode** newNodes = this->getNewVector(newSize);
 
index 6429978..5827369 100644 (file)
@@ -876,7 +876,6 @@ GenTreeArgList* Compiler::impPopList(unsigned count, CORINFO_SIG_INFO* sig, GenT
         CORINFO_CLASS_HANDLE    argClass;
         CORINFO_CLASS_HANDLE    argRealClass;
         GenTreeArgList*         args;
-        unsigned                sigSize;
 
         for (args = treeList, count = sig->numArgs; count > 0; args = args->Rest(), count--)
         {
@@ -5771,7 +5770,6 @@ void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI
 
     if (!opts.IsReadyToRun() || IsTargetAbi(CORINFO_CORERT_ABI))
     {
-        LclVarDsc* newObjArrayArgsVar;
 
         // Reuse the temp used to pass the array dimensions to avoid bloating
         // the stack frame in case there are multiple calls to multi-dim array
@@ -10354,7 +10352,6 @@ void Compiler::impImportBlockCode(BasicBlock* block)
             int val;
 
             CORINFO_SIG_INFO     sig;
-            unsigned             flags;
             IL_OFFSET            jmpAddr;
             bool                 ovfl, unordered, callNode;
             bool                 ldstruct;
index 028fdc9..3f4d3a1 100644 (file)
@@ -1935,7 +1935,6 @@ void Compiler::fgComputeLife(VARSET_TP&       life,
                              bool* pStmtInfoDirty DEBUGARG(bool* treeModf))
 {
     GenTreePtr tree;
-    unsigned   lclNum;
 
     // Don't kill vars in scope
     VARSET_TP keepAliveVars(VarSetOps::Union(this, volatileVars, compCurBB->bbScope));
index b37cf37..d818088 100644 (file)
@@ -5296,7 +5296,6 @@ bool Lowering::IndirsAreEquivalent(GenTreePtr candidate, GenTreePtr storeInd)
     pTreeB = pTreeB->gtSkipReloadOrCopy();
 
     genTreeOps oper;
-    unsigned   kind;
 
     if (pTreeA->OperGet() != pTreeB->OperGet())
     {
index c2258f0..b9d475b 100644 (file)
@@ -11459,8 +11459,6 @@ void TreeNodeInfo::dump(LinearScan* lsra)
 
 void LinearScan::lsraDumpIntervals(const char* msg)
 {
-    Interval* interval;
-
     printf("\nLinear scan intervals %s:\n", msg);
     for (auto& interval : intervals)
     {
index 53aebe0..6203afb 100644 (file)
@@ -137,9 +137,6 @@ void LinearScan::TreeNodeInfoInit(GenTree* tree)
     SetContainsAVXFlags(varTypeIsFloating(tree->TypeGet()));
     switch (tree->OperGet())
     {
-        GenTree* op1;
-        GenTree* op2;
-
         default:
             TreeNodeInfoInitSimple(tree);
             break;
@@ -456,10 +453,12 @@ void LinearScan::TreeNodeInfoInit(GenTree* tree)
             break;
 
         case GT_LOCKADD:
-            op2            = tree->gtOp.gtOp2;
+        {
+            GenTreePtr op2 = tree->gtOp.gtOp2;
             info->srcCount = op2->isContained() ? 1 : 2;
             assert(info->dstCount == (tree->TypeGet() == TYP_VOID) ? 0 : 1);
-            break;
+        }
+        break;
 
         case GT_PUTARG_REG:
             TreeNodeInfoInitPutArgReg(tree->AsUnOp());
index 42c5a2a..73e07ff 100644 (file)
@@ -4735,8 +4735,6 @@ void Compiler::fgMorphSystemVStructArgs(GenTreeCall* call, bool hasStructArgumen
 //
 void Compiler::fgMorphMultiregStructArgs(GenTreeCall* call)
 {
-    GenTreePtr   args;
-    GenTreePtr   argx;
     bool         foundStructArg = false;
     unsigned     initialFlags   = call->gtFlags;
     unsigned     flagsSummary   = 0;
@@ -4757,7 +4755,7 @@ void Compiler::fgMorphMultiregStructArgs(GenTreeCall* call)
 #endif // !UNIX_AMD64_ABI
 #endif
 
-    for (args = call->gtCallArgs; args != nullptr; args = args->gtOp.gtOp2)
+    for (GenTreePtr args = call->gtCallArgs; args != nullptr; args = args->gtOp.gtOp2)
     {
         // For late arguments the arg tree that is overridden is in the gtCallLateArgs list.
         // For such late args the gtCallArgList contains the setup arg node (evaluating the arg.)
@@ -12471,14 +12469,11 @@ DONE_MORPHING_CHILDREN:
      * Perform the required oper-specific postorder morphing
      */
 
-    GenTreePtr           temp;
-    GenTreePtr           cns1, cns2;
-    GenTreePtr           thenNode;
-    GenTreePtr           elseNode;
-    size_t               ival1, ival2;
-    GenTreePtr           lclVarTree;
-    GenTreeLclVarCommon* lclVarCmnTree;
-    FieldSeqNode*        fieldSeq = nullptr;
+    GenTreePtr    temp;
+    GenTreePtr    cns1, cns2;
+    size_t        ival1, ival2;
+    GenTreePtr    lclVarTree;
+    FieldSeqNode* fieldSeq = nullptr;
 
     switch (oper)
     {
@@ -13080,7 +13075,7 @@ DONE_MORPHING_CHILDREN:
 
 #ifdef LEGACY_BACKEND
         case GT_QMARK:
-
+        {
             /* If op1 is a comma throw node then we won't be keeping op2 */
             if (fgIsCommaThrow(op1))
             {
@@ -13090,8 +13085,8 @@ DONE_MORPHING_CHILDREN:
             /* Get hold of the two branches */
 
             noway_assert(op2->OperGet() == GT_COLON);
-            elseNode = op2->AsColon()->ElseNode();
-            thenNode = op2->AsColon()->ThenNode();
+            GenTreePtr thenNode = op2->AsColon()->ThenNode();
+            GenTreePtr elseNode = op2->AsColon()->ElseNode();
 
             /* Try to hoist assignments out of qmark colon constructs.
                ie. replace (cond?(x=a):(x=b)) with (x=(cond?a:b)). */
@@ -13197,9 +13192,9 @@ DONE_MORPHING_CHILDREN:
                 }
             }
 #endif // !_TARGET_ARM_
-
-            break; // end case GT_QMARK
-#endif             // LEGACY_BACKEND
+        }
+        break; // end case GT_QMARK
+#endif         // LEGACY_BACKEND
 
         case GT_MUL:
 
@@ -16698,9 +16693,7 @@ void Compiler::fgMorphBlocks()
         }
 #endif
 
-        /* Process all statement trees in the basic block */
-
-        GenTreePtr tree;
+/* Process all statement trees in the basic block */
 
 #ifndef LEGACY_BACKEND
         fgMorphStmts(block, &lnot, &loadw);
@@ -16709,7 +16702,7 @@ void Compiler::fgMorphBlocks()
 
         if (mult && (opts.compFlags & CLFLG_TREETRANS) && !opts.compDbgCode && !opts.MinOpts())
         {
-            for (tree = block->bbTreeList; tree; tree = tree->gtNext)
+            for (GenTreePtr tree = block->bbTreeList; tree; tree = tree->gtNext)
             {
                 assert(tree->gtOper == GT_STMT);
                 GenTreePtr last = tree->gtStmt.gtStmtExpr;
@@ -19581,7 +19574,6 @@ bool Compiler::fgMorphCombineSIMDFieldAssignments(BasicBlock* block, GenTreePtr
         setLclRelatedToSIMDIntrinsic(localDst);
     }
 
-    GenTree* simdStructAddr;
     if (simdStructNode->TypeGet() == TYP_BYREF)
     {
         assert(simdStructNode->OperIsLocal());
index bcb5a4c..7c42852 100644 (file)
@@ -871,9 +871,6 @@ void Compiler::optValnumCSE_InitDataFlow()
 {
     for (BasicBlock* block = fgFirstBB; block; block = block->bbNext)
     {
-        GenTreePtr stmt;
-        GenTreePtr tree;
-
         /* Initialize the blocks's bbCseIn set */
 
         bool init_to_zero = false;
index 77b201f..0428591 100644 (file)
@@ -6503,7 +6503,6 @@ void Compiler::optHoistThisLoop(unsigned lnum, LoopHoistContext* hoistCtxt)
     BasicBlock* head = pLoopDsc->lpHead;
     BasicBlock* tail = pLoopDsc->lpBottom;
     BasicBlock* lbeg = pLoopDsc->lpEntry;
-    BasicBlock* block;
 
     // We must have a do-while loop
     if ((pLoopDsc->lpFlags & LPFLG_DO_WHILE) == 0)
index 4e061fa..a72de57 100644 (file)
@@ -2113,7 +2113,6 @@ T GetSignedMagic(T denom, int* shift /*out*/)
     UT  q2;
     UT  t;
     T   result_magic;
-    int result_shift;
     int iters = 0;
 
     absDenom = abs(denom);