Skip to content

JIT: remove is rare check from finally cloning #110483

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

Merged
merged 1 commit into from
Dec 6, 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
9 changes: 0 additions & 9 deletions src/coreclr/jit/fgehopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,6 @@ PhaseStatus Compiler::fgCloneFinally()
unsigned regionBBCount = 0;
unsigned regionStmtCount = 0;
bool hasFinallyRet = false;
bool isAllRare = true;
bool hasSwitch = false;

for (BasicBlock* const block : Blocks(firstBlock, lastBlock))
Expand All @@ -1215,7 +1214,6 @@ PhaseStatus Compiler::fgCloneFinally()
}

hasFinallyRet = hasFinallyRet || block->KindIs(BBJ_EHFINALLYRET);
isAllRare = isAllRare && block->isRunRarely();
}

// Skip cloning if the finally has a switch.
Expand All @@ -1232,13 +1230,6 @@ PhaseStatus Compiler::fgCloneFinally()
continue;
}

// Skip cloning if the finally is rarely run code.
if (isAllRare)
{
JITDUMP("Finally in EH#%u is run rarely; skipping.\n", XTnum);
continue;
}

// Empirical studies from CoreCLR and CoreFX show that less
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this PR, but it might be interesting to revisit comments like these by looking at some JIT metrics.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that is on my todo list ...

// that 1% of finally regions have more than 15
// statements. So, to avoid potentially excessive code growth,
Expand Down
Loading