Delete OldStyleClearD. (#14874)
authorSergey Andreenko <seandree@microsoft.com>
Tue, 7 Nov 2017 00:38:05 +0000 (16:38 -0800)
committerGitHub <noreply@github.com>
Tue, 7 Nov 2017 00:38:05 +0000 (16:38 -0800)
* 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
src/jit/bitset.h
src/jit/bitsetasshortlong.h
src/jit/bitsetasuint64.h
src/jit/bitsetasuint64inclass.h
src/jit/copyprop.cpp
src/jit/emit.cpp
src/jit/flowgraph.cpp
src/jit/regalloc.cpp

index 24c6d26..77899c7 100644 (file)
@@ -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;
 }
 
index 73baa55..df03dee 100644 (file)
@@ -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);
index ef68ba8..f11aa8e 100644 (file)
@@ -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 <typename Env, typename BitSetTraits>
 void BitSetOps</*BitSetType*/ BitSetShortLongRep,
                /*Brand*/ BSShortLong,
                /*Env*/ Env,
-               /*BitSetTraits*/ BitSetTraits>::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 <typename Env, typename BitSetTraits>
-void BitSetOps</*BitSetType*/ BitSetShortLongRep,
-               /*Brand*/ BSShortLong,
-               /*Env*/ Env,
                /*BitSetTraits*/ BitSetTraits>::ClearDLong(Env env, BitSetShortLongRep& bs)
 {
     assert(!IsShort(env));
index a1acaa5..fe439ee 100644 (file)
@@ -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;
index 3680f2c..fe5d73a 100644 (file)
@@ -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);
index 75fc5c4..c9699f1 100644 (file)
@@ -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)
index 8e670d3..936481a 100644 (file)
@@ -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;
 
index 460a11f..60d4d06 100644 (file)
@@ -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;
index 9d630ef..005ba02 100644 (file)
@@ -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,