Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Delete OldStyleClearD. (#14874)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Sergey Andreenko authored Nov 7, 2017
1 parent c3ef1e9 commit 59d1b31
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
14 changes: 0 additions & 14 deletions src/jit/bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
26 changes: 0 additions & 26 deletions src/jit/bitsetasshortlong.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class BitSetOps</*BitSetType*/ BitSetShortLongRep,
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);
Expand Down Expand Up @@ -123,19 +122,6 @@ class BitSetOps</*BitSetType*/ BitSetShortLongRep,
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))
Expand Down Expand Up @@ -671,18 +657,6 @@ void BitSetOps</*BitSetType*/ BitSetShortLongRep,
bs[index] &= mask;
}

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,
Expand Down
5 changes: 0 additions & 5 deletions src/jit/bitsetasuint64.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ class BitSetOps</*BitSetType*/ UINT64,
lhs = rhs;
}

static void OldStyleClearD(Env env, UINT64& bs)
{
bs = 0;
}

static void ClearD(Env env, UINT64& bs)
{
bs = 0;
Expand Down
15 changes: 0 additions & 15 deletions src/jit/bitsetasuint64inclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,6 @@ class BitSetUint64
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));
Expand Down Expand Up @@ -322,11 +312,6 @@ class BitSetOps</*BitSetType*/ BitSetUint64<Env, BitSetTraits>,
lhs = rhs;
}

static void OldStyleClearD(Env env, BST& bs)
{
bs.OldStyleClearD(env);
}

static void ClearD(Env env, BST& bs)
{
bs.ClearD(env);
Expand Down
2 changes: 1 addition & 1 deletion src/jit/copyprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/jit/regalloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 59d1b31

Please sign in to comment.