Skip to content

Commit

Permalink
JIT: Compact newly recognized loops (dotnet#97149)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbotsch authored Jan 19, 2024
1 parent f6824bc commit a18d8cd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4409,11 +4409,6 @@ bool Compiler::optCompactLoops()
bool changed = false;
for (FlowGraphNaturalLoop* loop : m_loops->InReversePostOrder())
{
if (!loop->GetHeader()->HasFlag(BBF_OLD_LOOP_HEADER_QUIRK))
{
continue;
}

changed |= optCompactLoop(loop);
}

Expand Down Expand Up @@ -4447,6 +4442,16 @@ bool Compiler::optCompactLoop(FlowGraphNaturalLoop* loop)
continue;
}

// If this is a CALLFINALLYRET that is not in the loop, but the
// CALLFINALLY was, then we have to leave it in place. For compaction
// purposes this doesn't really make any difference, since no codegen
// is associated with the CALLFINALLYRET anyway.
if (cur->isBBCallFinallyPairTail())
{
cur = cur->Next();
continue;
}

BasicBlock* lastNonLoopBlock = cur;
while (true)
{
Expand Down

0 comments on commit a18d8cd

Please sign in to comment.