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
33 changes: 7 additions & 26 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5145,37 +5145,18 @@ BasicBlockVisit FlowGraphNaturalLoop::VisitLoopBlocks(TFunc func)
template <typename TFunc>
BasicBlockVisit FlowGraphNaturalLoop::VisitLoopBlocksLexical(TFunc func)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should likely just remove it. The usages are just for duplicating loop blocks, and those probably don't need to be duplicated lexically anymore.

No need to make the change here if you don't want to, I can do it separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I saw #110020 is introducing new call sites for it, so I decided to keep it around to avoid conflicts with that PR. I can remove it in one go once that PR is in.

{
BasicBlock* top = m_header;
unsigned numLoopBlocks = 0;
VisitLoopBlocks([&](BasicBlock* block) {
if (block->bbNum < top->bbNum)
{
top = block;
}

numLoopBlocks++;
return BasicBlockVisit::Continue;
});
BasicBlock* const top = GetLexicallyTopMostBlock();
BasicBlock* const bottom = GetLexicallyBottomMostBlock();

INDEBUG(BasicBlock* prev = nullptr);
BasicBlock* cur = top;
while (numLoopBlocks > 0)
for (BasicBlock* const block : m_dfsTree->GetCompiler()->Blocks(top, bottom))
{
// If we run out of blocks the blocks aren't sequential.
assert(cur != nullptr);

if (ContainsBlock(cur))
if (ContainsBlock(block))
{
assert((prev == nullptr) || (prev->bbNum < cur->bbNum));

if (func(cur) == BasicBlockVisit::Abort)
if (func(block) == BasicBlockVisit::Abort)
{
return BasicBlockVisit::Abort;

INDEBUG(prev = cur);
numLoopBlocks--;
}
}

cur = cur->Next();
}

return BasicBlockVisit::Continue;
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/loopcloning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3064,8 +3064,6 @@ PhaseStatus Compiler::optCloneLoops()
m_dfsTree = fgComputeDfs();
m_loops = FlowGraphNaturalLoops::Find(m_dfsTree);
}

fgRenumberBlocks();
}

#ifdef DEBUG
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,6 @@ PhaseStatus Compiler::optUnrollLoops()
}

JITDUMP("A nested loop was unrolled. Doing another pass (pass %d)\n", passes + 1);
fgRenumberBlocks();
fgInvalidateDfsTree();
m_dfsTree = fgComputeDfs();
m_loops = FlowGraphNaturalLoops::Find(m_dfsTree);
Expand Down
Loading