Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Remove bbFallsThrough check in optFindLoopCompactionInsertionPoint #99827

Merged
merged 2 commits into from
Mar 19, 2024
Merged
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
34 changes: 33 additions & 1 deletion src/coreclr/jit/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2894,8 +2894,40 @@ BasicBlock* Compiler::optFindLoopCompactionInsertionPoint(FlowGraphNaturalLoop*
// out of the loop, and if possible find a spot that won't break up fall-through.
BasicBlock* bottom = loop->GetLexicallyBottomMostBlock();
BasicBlock* insertionPoint = bottom;
while (insertionPoint->bbFallsThrough() && !insertionPoint->IsLast())
while (!insertionPoint->IsLast())
{
switch (insertionPoint->GetKind())
{
case BBJ_ALWAYS:
if (!insertionPoint->JumpsToNext())
{
// Found a branch that isn't to the next block, so we won't split up any fall-through.
return insertionPoint;
}
break;

case BBJ_COND:
if (!insertionPoint->FalseTargetIs(insertionPoint->Next()))
{
// Found a conditional branch that doesn't have a false branch to the next block,
// so we won't split up any fall-through.
return insertionPoint;
}
break;

case BBJ_CALLFINALLY:
if (!insertionPoint->isBBCallFinallyPair())
{
// Found a retless BBJ_CALLFINALLY block, so we won't split up any fall-through.
return insertionPoint;
}
break;

default:
// No fall-through to split up.
return insertionPoint;
}

// Keep looking for a better insertion point if we can.
BasicBlock* newInsertionPoint = optTryAdvanceLoopCompactionInsertionPoint(loop, insertionPoint, top, bottom);
if (newInsertionPoint == nullptr)
Expand Down