From 59d1b313e443628350a284d88596c2681caacf55 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 24c6d26..77899c7 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 73baa55..df03dee 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 @@ public: 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 ef68ba8..f11aa8e 100644 --- a/src/jit/bitsetasshortlong.h +++ b/src/jit/bitsetasshortlong.h @@ -43,7 +43,6 @@ private: static void DiffDLong(Env env, BitSetShortLongRep& bs1, BitSetShortLongRep bs2); static void AddElemDLong(Env env, BitSetShortLongRep& bs, unsigned i); static void RemoveElemDLong(Env env, BitSetShortLongRep& bs, unsigned i); - static void OldStyleClearDLong(Env env, BitSetShortLongRep& bs); static void ClearDLong(Env env, BitSetShortLongRep& bs); static BitSetShortLongRep MakeUninitArrayBits(Env env); static BitSetShortLongRep MakeEmptyArrayBits(Env env); @@ -123,19 +122,6 @@ public: lhs = rhs; } - static void OldStyleClearD(Env env, BitSetShortLongRep& bs) - { - if (IsShort(env)) - { - bs = (BitSetShortLongRep) nullptr; - } - else - { - assert(bs != UninitVal()); - OldStyleClearDLong(env, bs); - } - } - static void ClearD(Env env, BitSetShortLongRep& bs) { if (IsShort(env)) @@ -675,18 +661,6 @@ template 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::ClearDLong(Env env, BitSetShortLongRep& bs) { assert(!IsShort(env)); diff --git a/src/jit/bitsetasuint64.h b/src/jit/bitsetasuint64.h index a1acaa5..fe439ee 100644 --- a/src/jit/bitsetasuint64.h +++ b/src/jit/bitsetasuint64.h @@ -44,11 +44,6 @@ public: lhs = rhs; } - static void OldStyleClearD(Env env, UINT64& bs) - { - bs = 0; - } - static void ClearD(Env env, UINT64& bs) { bs = 0; diff --git a/src/jit/bitsetasuint64inclass.h b/src/jit/bitsetasuint64inclass.h index 3680f2c..fe5d73a 100644 --- a/src/jit/bitsetasuint64inclass.h +++ b/src/jit/bitsetasuint64inclass.h @@ -168,16 +168,6 @@ private: return res; } - inline void OldStyleClearD(Env env) - { - // Recall that OldStyleClearD does *not* require "*this" to be of the current epoch. - Uint64BitSetOps::OldStyleClearD(env, m_bits); -#ifdef DEBUG - // But it updates it to of the current epoch. - m_epoch = BitSetTraits::GetEpoch(env); -#endif - } - inline void ClearD(Env env) { assert(m_epoch == BitSetTraits::GetEpoch(env)); @@ -322,11 +312,6 @@ public: 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 75fc5c4..c9699f1 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 8e670d3..936481a 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 460a11f..60d4d06 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 9d630ef..005ba02 100644 --- a/src/jit/regalloc.cpp +++ b/src/jit/regalloc.cpp @@ -1342,7 +1342,7 @@ RET: 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, -- 2.7.4