Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 1 addition & 37 deletions src/coreclr/jit/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,35 +554,6 @@ unsigned BasicBlock::dspPreds()
return count;
}

/*****************************************************************************
*
* Display the bbCheapPreds basic block list (the block predecessors).
* Returns the number of characters printed.
*/

unsigned BasicBlock::dspCheapPreds()
{
unsigned count = 0;
for (BasicBlockList* pred = bbCheapPreds; pred != nullptr; pred = pred->next)
{
if (count != 0)
{
printf(",");
count += 1;
}
printf(FMT_BB, pred->block->bbNum);
count += 4;

// Account for %02u only handling 2 digits, but we can display more than that.
unsigned digits = CountDigits(pred->block->bbNum);
if (digits > 2)
{
count += digits - 2;
}
}
return count;
}

//------------------------------------------------------------------------
// dspSuccs: Display the basic block successors.
//
Expand Down Expand Up @@ -731,14 +702,7 @@ void BasicBlock::dspBlockHeader(Compiler* compiler,
if (showPreds)
{
printf(", preds={");
if (compiler->fgCheapPredsValid)
{
dspCheapPreds();
}
else
{
dspPreds();
}
dspPreds();
printf("} succs={");
dspSuccs(compiler);
printf("}");
Expand Down
18 changes: 5 additions & 13 deletions src/coreclr/jit/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ struct BasicBlock : private LIR::Range

#ifdef DEBUG
void dspFlags(); // Print the flags
unsigned dspCheapPreds(); // Print the predecessors (bbCheapPreds)
unsigned dspPreds(); // Print the predecessors (bbPreds)
void dspSuccs(Compiler* compiler); // Print the successors. The 'compiler' argument determines whether EH
// regions are printed: see NumSucc() for details.
Expand Down Expand Up @@ -1052,16 +1051,11 @@ struct BasicBlock : private LIR::Range
unsigned short bbFPinVars; // number of inner enregistered FP vars
};

// Basic block predecessor lists. Early in compilation, some phases might need to compute "cheap" predecessor
// lists. These are stored in bbCheapPreds, computed by fgComputeCheapPreds(). If bbCheapPreds is valid,
// 'fgCheapPredsValid' will be 'true'. Later, the "full" predecessor lists are created by fgComputePreds(), stored
// Basic block predecessor lists. Predecessor lists are created by fgLinkBasicBlocks(), stored
// in 'bbPreds', and then maintained throughout compilation. 'fgComputePredsDone' will be 'true' after the
// full predecessor lists are created. See the comment at fgComputeCheapPreds() to see how those differ from
// the "full" variant.
union {
BasicBlockList* bbCheapPreds; // ptr to list of cheap predecessors (used before normal preds are computed)
flowList* bbPreds; // ptr to list of predecessors
};
// predecessor lists are created.
//
flowList* bbPreds; // ptr to list of predecessors

// PredEdges: convenience method for enabling range-based `for` iteration over predecessor edges, e.g.:
// for (flowList* const edge : block->PredEdges()) ...
Expand Down Expand Up @@ -1774,9 +1768,7 @@ inline BBArrayIterator BasicBlock::BBSuccList::end() const
// by Compiler::fgReorderBlocks()
//
// We have a simpler struct, BasicBlockList, which is simply a singly-linked
// list of blocks. This is used for various purposes, but one is as a "cheap"
// predecessor list, computed by fgComputeCheapPreds(), and stored as a list
// on BasicBlock pointed to by bbCheapPreds.
// list of blocks.

struct BasicBlockList
{
Expand Down
14 changes: 0 additions & 14 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8860,7 +8860,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
* cVarDsc, dVarDsc : Display a local variable given a LclVarDsc* (call lvaDumpEntry()).
* cVars, dVars : Display the local variable table (call lvaTableDump()).
* cVarsFinal, dVarsFinal : Display the local variable table (call lvaTableDump(FINAL_FRAME_LAYOUT)).
* cBlockCheapPreds, dBlockCheapPreds : Display a block's cheap predecessors (call block->dspCheapPreds()).
* cBlockPreds, dBlockPreds : Display a block's predecessors (call block->dspPreds()).
* cBlockSuccs, dBlockSuccs : Display a block's successors (call block->dspSuccs(compiler)).
* cReach, dReach : Display all block reachability (call fgDispReach()).
Expand Down Expand Up @@ -8962,14 +8961,6 @@ void cVarsFinal(Compiler* comp)
comp->lvaTableDump(Compiler::FINAL_FRAME_LAYOUT);
}

void cBlockCheapPreds(Compiler* comp, BasicBlock* block)
{
static unsigned sequenceNumber = 0; // separate calls with a number to indicate this function has been called
printf("===================================================================== *BlockCheapPreds %u\n",
sequenceNumber++);
block->dspCheapPreds();
}

void cBlockPreds(Compiler* comp, BasicBlock* block)
{
static unsigned sequenceNumber = 0; // separate calls with a number to indicate this function has been called
Expand Down Expand Up @@ -9115,11 +9106,6 @@ void dBlockPreds(BasicBlock* block)
cBlockPreds(JitTls::GetCompiler(), block);
}

void dBlockCheapPreds(BasicBlock* block)
{
cBlockCheapPreds(JitTls::GetCompiler(), block);
}

void dBlockSuccs(BasicBlock* block)
{
cBlockSuccs(JitTls::GetCompiler(), block);
Expand Down
17 changes: 0 additions & 17 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4513,7 +4513,6 @@ class Compiler

bool fgModified; // True if the flow graph has been modified recently
bool fgComputePredsDone; // Have we computed the bbPreds list
bool fgCheapPredsValid; // Is the bbCheapPreds list valid?
bool fgDomsComputed; // Have we computed the dominator sets?
bool fgReturnBlocksComputed; // Have we computed the return blocks list?
bool fgOptimizedFinally; // Did we optimize any try-finallys?
Expand Down Expand Up @@ -5223,22 +5222,6 @@ class Compiler
//
void fgUpdateChangedFlowGraph(FlowGraphUpdates updates);

public:
// Compute the predecessors of the blocks in the control flow graph.
void fgComputePreds();

// Remove all predecessor information.
void fgRemovePreds();

// Compute the cheap flow graph predecessors lists. This is used in some early phases
// before the full predecessors lists are computed.
void fgComputeCheapPreds();

private:
void fgAddCheapPred(BasicBlock* block, BasicBlock* blockPred);

void fgRemoveCheapPred(BasicBlock* block, BasicBlock* blockPred);

public:
enum GCPollType
{
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ void Compiler::fgInit()
/* We haven't yet computed the bbPreds lists */
fgComputePredsDone = false;

/* We haven't yet computed the bbCheapPreds lists */
fgCheapPredsValid = false;

/* We haven't yet computed the edge weight */
fgEdgeWeightsComputed = false;
fgHaveValidEdgeWeights = false;
Expand Down Expand Up @@ -641,7 +638,6 @@ void Compiler::fgReplacePred(BasicBlock* block, BasicBlock* oldPred, BasicBlock*
noway_assert(block != nullptr);
noway_assert(oldPred != nullptr);
noway_assert(newPred != nullptr);
assert(!fgCheapPredsValid);

bool modified = false;

Expand Down
23 changes: 3 additions & 20 deletions src/coreclr/jit/fgdiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1871,15 +1871,7 @@ void Compiler::fgTableDispBasicBlock(BasicBlock* block, int ibcColWidth /* = 0 *
// Display block predecessor list
//

unsigned charCnt;
if (fgCheapPredsValid)
{
charCnt = block->dspCheapPreds();
}
else
{
charCnt = block->dspPreds();
}
unsigned charCnt = block->dspPreds();

if (charCnt < 19)
{
Expand Down Expand Up @@ -2283,7 +2275,6 @@ void Compiler::fgDispBasicBlocks(BasicBlock* firstBlock, BasicBlock* lastBlock,
maxBlockNumWidth, "----");
printf("BBnum %*sBBid ref try hnd %s weight %*s%s lp [IL range] [jump]%*s [EH region] [flags]\n",
padWidth, "",
fgCheapPredsValid ? "cheap preds" :
(fgComputePredsDone ? "preds "
: " "),
((ibcColWidth > 0) ? ibcColWidth - 3 : 0), "", // Subtract 3 for the width of "IBC", printed next.
Expand Down Expand Up @@ -2504,11 +2495,6 @@ class BBPredsChecker
// the number of incoming edges for the block.
unsigned BBPredsChecker::CheckBBPreds(BasicBlock* block, unsigned curTraversalStamp)
{
if (comp->fgCheapPredsValid)
{
return 0;
}

if (!comp->fgComputePredsDone)
{
assert(block->bbPreds == nullptr);
Expand Down Expand Up @@ -2857,11 +2843,8 @@ void Compiler::fgDebugCheckBBlist(bool checkBBNum /* = false */, bool checkBBRef

if (block->bbCatchTyp == BBCT_FILTER)
{
if (!fgCheapPredsValid) // Don't check cheap preds
{
// A filter has no predecessors
assert(block->bbPreds == nullptr);
}
// A filter has no predecessors
assert(block->bbPreds == nullptr);
}

#if defined(FEATURE_EH_FUNCLETS)
Expand Down
Loading