Skip to content

JIT: Only process regular succs for end-of-block PHI insertions #94958

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

Closed

Conversation

jakobbotsch
Copy link
Member

When inserting PHI args into successors as part of getting to the end of
a block in SSA we really only need to visit regular successors. EH
successors are handled on entry to the try and eagerly when we see
stores.

This also means we can avoid the search to check for duplicate (pred,
SSA num) pairs in many cases. These should really only be possible for
handlers.

There is one questionable case here which is regular control flow from
the end of filters into enclosed handlers. I need to think a bit about
that... I do not think we have correctness problems since we know that
only happens if we came from inside the try, but I dislike that we won't
have an explicit phi arg with the filter as a pred.

When we saw a def we were only adding phi args to enclosing handlers,
but this misses the special case of throws inside filters, where control
can flow to enclosed handlers.

Fix dotnet#94954
When inserting PHI args into successors as part of getting to the end of
a block in SSA we really only need to visit regular successors. EH
successors are handled on entry to the try and eagerly when we see
stores.

This also means we can avoid the search to check for duplicate (pred,
SSA num) pairs in many cases. These should really only be possible for
handlers.

There is one questionable case here which is regular control flow from
the end of filters into enclosed handlers. I need to think a bit about
that... I do not think we have correctness problems since we know that
only happens if we came from inside the try, but I dislike that we won't
have an explicit phi arg with the filter as a pred.
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 18, 2023
@ghost ghost assigned jakobbotsch Nov 18, 2023
@ghost
Copy link

ghost commented Nov 18, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

When inserting PHI args into successors as part of getting to the end of
a block in SSA we really only need to visit regular successors. EH
successors are handled on entry to the try and eagerly when we see
stores.

This also means we can avoid the search to check for duplicate (pred,
SSA num) pairs in many cases. These should really only be possible for
handlers.

There is one questionable case here which is regular control flow from
the end of filters into enclosed handlers. I need to think a bit about
that... I do not think we have correctness problems since we know that
only happens if we came from inside the try, but I dislike that we won't
have an explicit phi arg with the filter as a pred.

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch
Copy link
Member Author

TP improvement was around 0.1%, which doesn't seem worth the trouble.

@jakobbotsch jakobbotsch closed this Dec 7, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant