-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: account for newly unreachable blocks in morph #109394
JIT: account for newly unreachable blocks in morph #109394
Conversation
Morph can alter control flow, if (for instance) it can prove a block's conditional branch must go a certain way. Take advantage of this to improve morph's cross-block assertion prop, by not considering unreachable predecessors when computing the incoming assertion state. This is similar to something we already do in value numbering, but there control flow isn't being altered. Also, when we can prove that a block has become unreachable, remove the block IR and alter its jump kind, so we are not spending time morphing IR we'll subsequently just throw away.
We might want something like this in local morph too... see eg this comment in #104250. |
src/coreclr/jit/morph.cpp
Outdated
// We will track which blocks become unreachable during morph | ||
// | ||
EnsureBasicBlockEpoch(); | ||
BlockSet unreachable = BlockSetOps::MakeEmpty(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use post-order number based bit vectors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
I was actually thinking I could possibly just rely on edge removal, though there are some odd cases where we artificially bump up ref counts to keep blocks from being considered unreachable.
SPMI results are way more variable across ABI/ISA than I'd expect. Not sure if this is missing collections or something more fundamental...
Still vexed by BBJ_CALLFINALLY issues. |
Diffs -- both size and TP wins. |
@jakobbotsch PTAL Diffs -- good size and TP wins. Haven't looked at regressions extensively, but saw one case where morph copy-propped a normal local into uses of a "is never negative" local and so we lost the "is never negative" aspect, and this caused us to miss an RBO because of signed/unsigned differences in VN. Will fire up some stress... |
/azp run runtime-coreclr jitstress |
Azure Pipelines successfully started running 1 pipeline(s). |
Morph can alter control flow, if (for instance) it can prove a block's conditional branch must go a certain way.
Take advantage of this to improve morph's cross-block assertion prop, by not considering unreachable predecessors when computing the incoming assertion state. This is similar to something we already do in value numbering, but there control flow isn't being altered.
Also, when we can prove that a block has become unreachable, remove the block IR and alter its jump kind, so we are not spending time morphing IR we'll subsequently just throw away.