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: Propagate LCL_ADDRs into handlers #109182

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Oct 24, 2024

Expand the support for LCL_ADDR propagation to keep assertions around in handler blocks when they are true at all points in all predecessor blocks of those handlers. This requires keeping track of the "always true" assertions for each block.

For context, see discussion around #102965 (comment)

Expand the support for LCL_ADDR propagation to keep assertions around in
handler blocks when they are true at all points in all predecessor
blocks of those handlers. This requires keeping track of the "always
true" assertions for each block.
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 24, 2024
Copy link
Contributor

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

@jakobbotsch
Copy link
Member Author

cc @AndyAyersMS

@jakobbotsch
Copy link
Member Author

jakobbotsch commented Oct 24, 2024

It seems like we could avoid storing both sets of assertions if we pushed facts into successors instead of pulling them from predecessors; then at the end of each block we would just intersect the regular successor's "assertions-in" set with the block's "assertions-out" set, and the EH successor's "assertions-in" set with the block's "always-assertions" set.

However, it would add a visit to all block's successors, and we wouldn't be able to remove the loop over predecessors since it's still needed to know if this block is a target of a backedge.

If the DFS traversal saved the targets of backedges we would be able to avoid the loop over the pred list (and loop finding could use it to directly find header candidates). But overall it seems simpler to just stick to the current approach and store an extra 8 bytes per basic block, which is a very small amount of memory anyway.

@jakobbotsch jakobbotsch marked this pull request as ready for review October 24, 2024 14:25
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

Diffs

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

This seems better than what I had in mind. Thanks!

@jakobbotsch jakobbotsch merged commit 3db28cd into dotnet:main Oct 24, 2024
108 checks passed
@jakobbotsch jakobbotsch deleted the LCL_ADDR-propagate-eh branch October 24, 2024 16:25
@github-actions github-actions bot locked and limited conversation to collaborators Nov 24, 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.

2 participants