Skip to content

Commit

Permalink
Remove obsolete DEBUG only instance variable BasicBlock::bbLoopNum (#…
Browse files Browse the repository at this point in the history
…34652)

* Remove obsolete DEBUG only instance variable BasicBlock::bbLoopNum

Comment at declaration in block.h

    // This is the label a loop gets as part of the second, reachability-based
    // loop discovery mechanism.  This is apparently only used for debugging.
    // We hope we'll eventually just have one loop-discovery mechanism, and this will go away.
    INDEBUG(loopNumber bbLoopNum;) // set to 'n' for a loop #n header

* Run jit-format
  • Loading branch information
briansull authored Apr 8, 2020
1 parent 7fa7d85 commit 74bf6e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
1 change: 0 additions & 1 deletion src/coreclr/src/jit/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,6 @@ bool BasicBlock::CloneBlockState(
VarSetOps::AssignAllowUninitRhs(compiler, to->bbScope, from->bbScope);
to->bbNatLoopNum = from->bbNatLoopNum;
#ifdef DEBUG
to->bbLoopNum = from->bbLoopNum;
to->bbTgtStkDepth = from->bbTgtStkDepth;
#endif // DEBUG

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/src/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,11 +847,6 @@ struct BasicBlock : private LIR::Range
typedef unsigned char loopNumber;
static const unsigned NOT_IN_LOOP = UCHAR_MAX;

// This is the label a loop gets as part of the second, reachability-based
// loop discovery mechanism. This is apparently only used for debugging.
// We hope we'll eventually just have one loop-discovery mechanism, and this will go away.
INDEBUG(loopNumber bbLoopNum;) // set to 'n' for a loop #n header

loopNumber bbNatLoopNum; // Index, in optLoopTable, of most-nested loop that contains this block,
// or else NOT_IN_LOOP if this block is not in a loop.

Expand Down
27 changes: 6 additions & 21 deletions src/coreclr/src/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,16 @@ void Compiler::optMarkLoopBlocks(BasicBlock* begBlk, BasicBlock* endBlk, bool ex
noway_assert(begBlk->bbNum <= endBlk->bbNum);
noway_assert(begBlk->isLoopHead());
noway_assert(fgReachable(begBlk, endBlk));
noway_assert(!opts.MinOpts());

#ifdef DEBUG
if (verbose)
{
printf("\nMarking loop L%02u", begBlk->bbLoopNum);
printf("\nMarking a loop from " FMT_BB " to " FMT_BB, begBlk->bbNum,
excludeEndBlk ? endBlk->bbPrev->bbNum : endBlk->bbNum);
}
#endif

noway_assert(!opts.MinOpts());

/* Build list of backedges for block begBlk */
flowList* backedgeList = nullptr;

Expand Down Expand Up @@ -327,11 +327,11 @@ void Compiler::optUnmarkLoopBlocks(BasicBlock* begBlk, BasicBlock* endBlk)
{
if (backEdgeCount > 0)
{
printf("\nNot removing loop L%02u, due to an additional back edge", begBlk->bbLoopNum);
printf("\nNot removing loop at " FMT_BB ", due to an additional back edge", begBlk->bbNum);
}
else if (backEdgeCount == 0)
{
printf("\nNot removing loop L%02u, due to no back edge", begBlk->bbLoopNum);
printf("\nNot removing loop at " FMT_BB ", due to no back edge", begBlk->bbNum);
}
}
#endif
Expand All @@ -343,7 +343,7 @@ void Compiler::optUnmarkLoopBlocks(BasicBlock* begBlk, BasicBlock* endBlk)
#ifdef DEBUG
if (verbose)
{
printf("\nUnmarking loop L%02u", begBlk->bbLoopNum);
printf("\nUnmarking loop at " FMT_BB, begBlk->bbNum);
}
#endif

Expand Down Expand Up @@ -651,14 +651,6 @@ void Compiler::optPrintLoopInfo(unsigned loopInd,
{
noway_assert(lpHead);

//
// NOTE: we take "loopInd" as an argument instead of using the one
// stored in begBlk->bbLoopNum because sometimes begBlk->bbLoopNum
// has not be set correctly. For example, in optRecordLoop().
// However, in most of the cases, loops should have been recorded.
// Therefore the correct way is to call the Compiler::optPrintLoopInfo(unsigned lnum)
// version of this method.
//
printf("L%02u, from " FMT_BB, loopInd, lpFirst->bbNum);
if (lpTop != lpFirst)
{
Expand Down Expand Up @@ -4371,8 +4363,6 @@ void Compiler::optOptimizeLayout()
continue;
}

assert(block->bbLoopNum == 0);

if (compCodeOpt() != SMALL_CODE)
{
/* Optimize "while(cond){}" loops to "cond; do{}while(cond);" */
Expand Down Expand Up @@ -4480,11 +4470,6 @@ void Compiler::optOptimizeLoops()
if (foundBottom)
{
loopNum++;
#ifdef DEBUG
/* Mark the loop header as such */
assert(FitsIn<unsigned char>(loopNum));
top->bbLoopNum = (unsigned char)loopNum;
#endif

/* Mark all blocks between 'top' and 'bottom' */

Expand Down

0 comments on commit 74bf6e5

Please sign in to comment.