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 fallthrough quirk in fgFindInsertPoint #99783

Merged
merged 3 commits into from
Mar 18, 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
13 changes: 7 additions & 6 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6390,12 +6390,13 @@ BasicBlock* Compiler::fgFindInsertPoint(unsigned regionIndex,
}
}

// Look for an insert location. We want blocks that don't end with a fall through.
// Quirk: Manually check for BBJ_COND fallthrough behavior
const bool blkFallsThrough =
blk->bbFallsThrough() && (!blk->KindIs(BBJ_COND) || blk->NextIs(blk->GetFalseTarget()));
const bool blkJumpsToNext = blk->KindIs(BBJ_ALWAYS) && blk->HasFlag(BBF_NONE_QUIRK) && blk->JumpsToNext();
if (!blkFallsThrough && !blkJumpsToNext)
// Look for an insert location.
// Avoid splitting up call-finally pairs, or jumps/false branches to the next block.
// (We need the HasInitializedTarget() call because fgFindInsertPoint can be called during importation,
// before targets are set)
const bool jumpsToNext = blk->KindIs(BBJ_ALWAYS) && blk->HasInitializedTarget() && blk->JumpsToNext();
const bool falseBranchToNext = blk->KindIs(BBJ_COND) && blk->NextIs(blk->GetFalseTarget());
if (!blk->isBBCallFinallyPair() && !jumpsToNext && !falseBranchToNext)
{
bool updateBestBlk = true; // We will probably update the bestBlk

Expand Down