diff options
Diffstat (limited to 'src/jit/liveness.cpp')
-rw-r--r-- | src/jit/liveness.cpp | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp index 19d326303e..423d72b9b2 100644 --- a/src/jit/liveness.cpp +++ b/src/jit/liveness.cpp @@ -76,7 +76,6 @@ void Compiler::fgMarkUseDef(GenTreeLclVarCommon* tree, GenTree* asgdLclVar) if ((lhsLclNum == lclNum) && ((tree->gtFlags & GTF_VAR_DEF) == 0) && (tree != asgdLclVar)) { /* bingo - we have an x = f(x) case */ - noway_assert(lvaTable[lhsLclNum].lvType != TYP_STRUCT); asgdLclVar->gtFlags |= GTF_VAR_USEDEF; rhsUSEDEF = true; } @@ -699,10 +698,6 @@ void Compiler::fgPerBlockLocalVarLiveness() } } -/*****************************************************************************/ -#ifdef DEBUGGING_SUPPORT -/*****************************************************************************/ - // Helper functions to mark variables live over their entire scope void Compiler::fgBeginScopeLife(VARSET_TP* inScope, VarScopeDsc* var) @@ -1113,7 +1108,7 @@ void Compiler::fgExtendDbgLifetimes() // Create initialization node if (!block->IsLIR()) { - GenTree* varNode = gtNewLclvNode(varNum, type); + GenTree* varNode = gtNewLclvNode(varNum, type); GenTree* initNode = gtNewAssignNode(varNode, zero); // Create a statement for the initializer, sequence it, and append it to the current BB. @@ -1124,7 +1119,8 @@ void Compiler::fgExtendDbgLifetimes() } else { - GenTree* store = new (this, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, type, varNum, BAD_IL_OFFSET); + GenTree* store = + new (this, GT_STORE_LCL_VAR) GenTreeLclVar(GT_STORE_LCL_VAR, type, varNum, BAD_IL_OFFSET); store->gtOp.gtOp1 = zero; store->gtFlags |= (GTF_VAR_DEF | GTF_ASG); @@ -1133,7 +1129,7 @@ void Compiler::fgExtendDbgLifetimes() #if !defined(_TARGET_64BIT_) && !defined(LEGACY_BACKEND) DecomposeLongs::DecomposeRange(this, blockWeight, initRange); -#endif +#endif // !defined(_TARGET_64BIT_) && !defined(LEGACY_BACKEND) // Naively inserting the initializer at the end of the block may add code after the block's // terminator, in which case the inserted code will never be executed (and the IR for the @@ -1184,10 +1180,6 @@ void Compiler::fgExtendDbgLifetimes() #endif // DEBUG } -/*****************************************************************************/ -#endif // DEBUGGING_SUPPORT -/*****************************************************************************/ - VARSET_VALRET_TP Compiler::fgGetHandlerLiveVars(BasicBlock* block) { noway_assert(block); @@ -1905,9 +1897,7 @@ VARSET_VALRET_TP Compiler::fgComputeLife(VARSET_VALARG_TP lifeArg, VARSET_TP VARSET_INIT(this, life, lifeArg); // lifeArg is const ref; copy to allow modification. VARSET_TP VARSET_INIT(this, keepAliveVars, volatileVars); -#ifdef DEBUGGING_SUPPORT VarSetOps::UnionD(this, keepAliveVars, compCurBB->bbScope); // Don't kill vars in scope -#endif noway_assert(VarSetOps::Equal(this, VarSetOps::Intersection(this, keepAliveVars, life), keepAliveVars)); noway_assert(compCurStmt->gtOper == GT_STMT); @@ -1955,9 +1945,7 @@ VARSET_VALRET_TP Compiler::fgComputeLifeLIR(VARSET_VALARG_TP lifeArg, BasicBlock VARSET_TP VARSET_INIT(this, life, lifeArg); // lifeArg is const ref; copy to allow modification. VARSET_TP VARSET_INIT(this, keepAliveVars, volatileVars); -#ifdef DEBUGGING_SUPPORT VarSetOps::UnionD(this, keepAliveVars, block->bbScope); // Don't kill vars in scope -#endif noway_assert(VarSetOps::Equal(this, VarSetOps::Intersection(this, keepAliveVars, life), keepAliveVars)); @@ -1980,9 +1968,9 @@ VARSET_VALRET_TP Compiler::fgComputeLifeLIR(VARSET_VALARG_TP lifeArg, BasicBlock else if (node->OperIsNonPhiLocal() || node->OperIsLocalAddr()) { bool isDeadStore = fgComputeLifeLocal(life, keepAliveVars, node, node); - if (isDeadStore) + if (isDeadStore && fgTryRemoveDeadLIRStore(blockRange, node, &next)) { - fgTryRemoveDeadLIRStore(blockRange, node, &next); + fgStmtRemoved = true; } } } @@ -2018,9 +2006,8 @@ VARSET_VALRET_TP Compiler::fgComputeLife(VARSET_VALARG_TP lifeArg, GenTreePtr gtColon = NULL; VARSET_TP VARSET_INIT(this, keepAliveVars, volatileVars); -#ifdef DEBUGGING_SUPPORT VarSetOps::UnionD(this, keepAliveVars, compCurBB->bbScope); /* Dont kill vars in scope */ -#endif + noway_assert(VarSetOps::Equal(this, VarSetOps::Intersection(this, keepAliveVars, life), keepAliveVars)); noway_assert(compCurStmt->gtOper == GT_STMT); noway_assert(endNode || (startNode == compCurStmt->gtStmt.gtStmtExpr)); @@ -2548,10 +2535,10 @@ bool Compiler::fgRemoveDeadStore( switch (asgNode->gtOper) { case GT_ASG_ADD: - asgNode->gtOper = GT_ADD; + asgNode->SetOperRaw(GT_ADD); break; case GT_ASG_SUB: - asgNode->gtOper = GT_SUB; + asgNode->SetOperRaw(GT_SUB); break; default: // Only add and sub allowed, we don't have ASG_MUL and ASG_DIV for ints, and @@ -2854,10 +2841,6 @@ void Compiler::fgInterBlockLocalVarLiveness() fgLiveVarAnalysis(); -//------------------------------------------------------------------------- - -#ifdef DEBUGGING_SUPPORT - /* For debuggable code, we mark vars as live over their entire * reported scope, so that it will be visible over the entire scope */ @@ -2867,8 +2850,6 @@ void Compiler::fgInterBlockLocalVarLiveness() fgExtendDbgLifetimes(); } -#endif // DEBUGGING_SUPPORT - /*------------------------------------------------------------------------- * Variables involved in exception-handlers and finally blocks need * to be specially marked |