Skip to content

Commit 4a30be3

Browse files
JIT: Remove VisitLoopBlocksLexical utility (#110490)
Follow-up to #110227. In the few places where we still visit loop blocks in lexical order, just visit them in RPO instead.
1 parent bf40019 commit 4a30be3

File tree

3 files changed

+2
-42
lines changed

3 files changed

+2
-42
lines changed

src/coreclr/jit/compiler.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,9 +2219,6 @@ class FlowGraphNaturalLoop
22192219
template<typename TFunc>
22202220
BasicBlockVisit VisitLoopBlocks(TFunc func);
22212221

2222-
template<typename TFunc>
2223-
BasicBlockVisit VisitLoopBlocksLexical(TFunc func);
2224-
22252222
template<typename TFunc>
22262223
BasicBlockVisit VisitRegularExitBlocks(TFunc func);
22272224

src/coreclr/jit/compiler.hpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5127,41 +5127,6 @@ BasicBlockVisit FlowGraphNaturalLoop::VisitLoopBlocks(TFunc func)
51275127
return VisitLoopBlocksReversePostOrder(func);
51285128
}
51295129

5130-
//------------------------------------------------------------------------------
5131-
// FlowGraphNaturalLoop::VisitLoopBlocksLexical: Visit the loop's blocks in
5132-
// lexical order.
5133-
//
5134-
// Type parameters:
5135-
// TFunc - Callback functor type
5136-
//
5137-
// Arguments:
5138-
// func - Callback functor that takes a BasicBlock* and returns a
5139-
// BasicBlockVisit.
5140-
//
5141-
// Returns:
5142-
// BasicBlockVisit that indicated whether the visit was aborted by the
5143-
// callback or whether all blocks were visited.
5144-
//
5145-
template <typename TFunc>
5146-
BasicBlockVisit FlowGraphNaturalLoop::VisitLoopBlocksLexical(TFunc func)
5147-
{
5148-
BasicBlock* const top = GetLexicallyTopMostBlock();
5149-
BasicBlock* const bottom = GetLexicallyBottomMostBlock();
5150-
5151-
for (BasicBlock* const block : m_dfsTree->GetCompiler()->Blocks(top, bottom))
5152-
{
5153-
if (ContainsBlock(block))
5154-
{
5155-
if (func(block) == BasicBlockVisit::Abort)
5156-
{
5157-
return BasicBlockVisit::Abort;
5158-
}
5159-
}
5160-
}
5161-
5162-
return BasicBlockVisit::Continue;
5163-
}
5164-
51655130
//------------------------------------------------------------------------------
51665131
// FlowGraphNaturalLoop::VisitRegularExitBlocks: Visit non-handler blocks that
51675132
// are outside the loop but that may have regular predecessors inside the loop.

src/coreclr/jit/flowgraph.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6001,9 +6001,7 @@ void FlowGraphNaturalLoop::Duplicate(BasicBlock** insertAfter, BlockToBlockMap*
60016001

60026002
Compiler* comp = m_dfsTree->GetCompiler();
60036003

6004-
BasicBlock* bottom = GetLexicallyBottomMostBlock();
6005-
6006-
VisitLoopBlocksLexical([=](BasicBlock* blk) {
6004+
VisitLoopBlocks([=](BasicBlock* blk) {
60076005
// Initialize newBlk as BBJ_ALWAYS without jump target, and fix up jump target later
60086006
// with BasicBlock::CopyTarget().
60096007
BasicBlock* newBlk = comp->fgNewBBafter(BBJ_ALWAYS, *insertAfter, /*extendRegion*/ true);
@@ -6213,7 +6211,7 @@ void FlowGraphNaturalLoop::DuplicateWithEH(BasicBlock** insertAfter, BlockToBloc
62136211
BitVecTraits traits(comp->compBasicBlockID, comp);
62146212
BitVec visited(BitVecOps::MakeEmpty(&traits));
62156213

6216-
VisitLoopBlocksLexical([=, &traits, &visited, &clonedTry, &ehIndexShift](BasicBlock* blk) {
6214+
VisitLoopBlocks([=, &traits, &visited, &clonedTry, &ehIndexShift](BasicBlock* blk) {
62176215
// Try cloning may have already handled this block
62186216
//
62196217
if (BitVecOps::IsMember(&traits, visited, blk->bbID))

0 commit comments

Comments
 (0)