From 1e4d73ed7ed575af668e71465c53d22a3d01a9d0 Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Mon, 6 Nov 2017 16:38:05 -0800 Subject: [PATCH] Delete OldStyleClearD. (#14874) * Delete OldStyleClearD from flowgraph BlockSetOps::Assign requires sets to have the same size, there is no an additional risk to use ClearD then. * delete OldStyleClearD from regalloc regalloc doesn't create new local variables and doesn't change epoch. * Delete OldStyleClearD from copyprop CopyProp doesn't create new vars. Also `VarSetOps::Assign(this, compCurLife, block->bbLiveIn); ` before the loop requires epoch to be the same. * Delete OldStyleClearD from assertionpop Assertion prop doesn't change epoch. * Delete OldStyleClearD from the emmit Because it doesn't create new local vars. * Delete declarations --- src/jit/assertionprop.cpp | 2 +- src/jit/bitset.h | 14 -------------- src/jit/bitsetasshortlong.h | 26 -------------------------- src/jit/bitsetasuint64.h | 5 ----- src/jit/bitsetasuint64inclass.h | 15 --------------- src/jit/copyprop.cpp | 2 +- src/jit/emit.cpp | 6 +++--- src/jit/flowgraph.cpp | 2 +- src/jit/regalloc.cpp | 4 ++-- 9 files changed, 8 insertions(+), 68 deletions(-) diff --git a/src/jit/assertionprop.cpp b/src/jit/assertionprop.cpp index 24c6d26eb38c..77899c748203 100644 --- a/src/jit/assertionprop.cpp +++ b/src/jit/assertionprop.cpp @@ -4563,7 +4563,7 @@ ASSERT_TP* Compiler::optInitAssertionDataflowFlags() } // Compute the data flow values for all tracked expressions // IN and OUT never change for the initial basic block B1 - BitVecOps::OldStyleClearD(apTraits, fgFirstBB->bbAssertionIn); + BitVecOps::ClearD(apTraits, fgFirstBB->bbAssertionIn); return jumpDestOut; } diff --git a/src/jit/bitset.h b/src/jit/bitset.h index 73baa553578e..df03dee50e8d 100644 --- a/src/jit/bitset.h +++ b/src/jit/bitset.h @@ -202,15 +202,6 @@ class BitSetOps // be copied into the lhs. static void AssignNoCopy(Env env, BitSetType& lhs, BitSetValueArgType rhs); - // Destructively set "bs" to be the empty set. This method is unique, in that it does *not* - // require "bs" to be a bitset of the current epoch. It ensures that it is after, however. - // (If the representation is indirect, this requires allocating a new, empty representation. - // If this is a performance issue, we could provide a new version of OldStyleClearD that assumes/asserts - // that the rep is for the current epoch -- this would be useful if a given bitset were repeatedly - // cleared within an epoch.) - // TODO #11263: delete it. - static void OldStyleClearD(Env env, BitSetType& bs); - // Destructively set "bs" to be the empty set. static void ClearD(Env env, BitSetType& bs); @@ -338,11 +329,6 @@ class BitSetOpsWithCounter BitSetTraits::GetOpCounter(env)->RecordOp(BitSetSupport::BSOP_AssignNocopy); BSO::AssignNoCopy(env, lhs, rhs); } - static void OldStyleClearD(Env env, BitSetType& bs) - { - BitSetTraits::GetOpCounter(env)->RecordOp(BitSetSupport::BSOP_OldStyleClearD); - BSO::OldStyleClearD(env, bs); - } static void ClearD(Env env, BitSetType& bs) { BitSetTraits::GetOpCounter(env)->RecordOp(BitSetSupport::BSOP_ClearD); diff --git a/src/jit/bitsetasshortlong.h b/src/jit/bitsetasshortlong.h index ef68ba85e9ea..f11aa8e1c2df 100644 --- a/src/jit/bitsetasshortlong.h +++ b/src/jit/bitsetasshortlong.h @@ -43,7 +43,6 @@ class BitSetOps -void BitSetOps::OldStyleClearDLong(Env env, BitSetShortLongRep& bs) -{ - assert(!IsShort(env)); - // Recall that OldStyleClearD does *not* require "bs" to be of the current epoch. - // Therefore, we must allocate a new representation. - bs = MakeEmptyArrayBits(env); -} - template void BitSetOps, lhs = rhs; } - static void OldStyleClearD(Env env, BST& bs) - { - bs.OldStyleClearD(env); - } - static void ClearD(Env env, BST& bs) { bs.ClearD(env); diff --git a/src/jit/copyprop.cpp b/src/jit/copyprop.cpp index 75fc5c48efff..c9699f190ca6 100644 --- a/src/jit/copyprop.cpp +++ b/src/jit/copyprop.cpp @@ -303,7 +303,7 @@ void Compiler::optBlockCopyProp(BasicBlock* block, LclNumToGenTreePtrStack* curS VarSetOps::Assign(this, compCurLife, block->bbLiveIn); for (GenTreePtr stmt = block->bbTreeList; stmt; stmt = stmt->gtNext) { - VarSetOps::OldStyleClearD(this, optCopyPropKillSet); + VarSetOps::ClearD(this, optCopyPropKillSet); // Walk the tree to find if any local variable can be replaced with current live definitions. for (GenTreePtr tree = stmt->gtStmt.gtStmtList; tree; tree = tree->gtNext) diff --git a/src/jit/emit.cpp b/src/jit/emit.cpp index 8e670d365959..936481a3d479 100644 --- a/src/jit/emit.cpp +++ b/src/jit/emit.cpp @@ -1471,8 +1471,8 @@ void emitter::emitBegProlog() /* Nothing is live on entry to the prolog */ // These were initialized to Empty at the start of compilation. - VarSetOps::OldStyleClearD(emitComp, emitInitGCrefVars); - VarSetOps::OldStyleClearD(emitComp, emitPrevGCrefVars); + VarSetOps::ClearD(emitComp, emitInitGCrefVars); + VarSetOps::ClearD(emitComp, emitPrevGCrefVars); emitInitGCrefRegs = RBM_NONE; emitPrevGCrefRegs = RBM_NONE; emitInitByrefRegs = RBM_NONE; @@ -4560,7 +4560,7 @@ unsigned emitter::emitEndCodeGen(Compiler* comp, /* Assume no live GC ref variables on entry */ - VarSetOps::OldStyleClearD(emitComp, emitThisGCrefVars); // This is initialized to Empty at the start of codegen. + VarSetOps::ClearD(emitComp, emitThisGCrefVars); // This is initialized to Empty at the start of codegen. emitThisGCrefRegs = emitThisByrefRegs = RBM_NONE; emitThisGCrefVset = true; diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp index 460a11faf8e0..60d4d06354d4 100644 --- a/src/jit/flowgraph.cpp +++ b/src/jit/flowgraph.cpp @@ -10422,7 +10422,7 @@ void Compiler::fgCompactBlocks(BasicBlock* block, BasicBlock* bNext) if (fgDomsComputed && block->bbNum > fgDomBBcount) { BlockSetOps::Assign(this, block->bbReach, bNext->bbReach); - BlockSetOps::OldStyleClearD(this, bNext->bbReach); + BlockSetOps::ClearD(this, bNext->bbReach); block->bbIDom = bNext->bbIDom; bNext->bbIDom = nullptr; diff --git a/src/jit/regalloc.cpp b/src/jit/regalloc.cpp index 9d630efba121..005ba020ffa0 100644 --- a/src/jit/regalloc.cpp +++ b/src/jit/regalloc.cpp @@ -1342,7 +1342,7 @@ regMaskTP Compiler::rpPredictRegPick(var_types type, rpPredictReg predictReg, re while (iter.NextElem(&varNum)) { // We'll need this for one of the calls... - VarSetOps::OldStyleClearD(this, varAsSet); + VarSetOps::ClearD(this, varAsSet); VarSetOps::AddElemD(this, varAsSet, varNum); // If this varBit and lastUse? @@ -6352,7 +6352,7 @@ void Compiler::rpPredictRegUse() /* Zero the variable/register interference graph */ for (unsigned i = 0; i < REG_COUNT; i++) { - VarSetOps::OldStyleClearD(this, raLclRegIntf[i]); + VarSetOps::ClearD(this, raLclRegIntf[i]); } // if there are PInvoke calls and compLvFrameListRoot is enregistered,