-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Implement jump threading MIR opt #107009
Merged
Merged
Implement jump threading MIR opt #107009
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8252ad0
Extract cost checker from inliner.
cjgillot 3cb0c2e
Make instance an option in CostChecker.
cjgillot 751a079
Implement JumpThreading pass.
cjgillot 0d0a536
Do not thread through loop headers.
cjgillot df9e5ee
Handle more terminators.
cjgillot 4abea83
Improve naming and comments.
cjgillot b5aa1ef
Document mutated_statement.
cjgillot 4705624
Make polarity an enum.
cjgillot 98b86fa
Document Condition.
cjgillot 6abd8f1
Rebase fallout.
cjgillot d5b21ef
Explicit notation.
cjgillot 66ec098
Simplify static if handling.
cjgillot 54b61d6
Reword TO application comments.
cjgillot 8fb99af
Correct loop_headers logic.
cjgillot a845bac
FileCheck annotations.
cjgillot dd08dd4
Expand comment on disappearing edge.
cjgillot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Correct loop_headers logic.
- Loading branch information
commit 8fb99afb0219846f98a82059de2f0808e4c0f61f
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 was wrong. Added a correction commit.
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.
So... the effect of this change is two-fold (when succ dominates bb): 1. it avoids adding
bb
to the loop headers, and 2. it addssucc
to the loop headers.I see essentially only one effect on the tests though (where that one effect is duplicated in two twos) -- and I think the effect demonstrated by the tests is due to the addition of adding
succ
to the loop headers (since that cancels out a threading opportunity, which I believe is what is happening in the panic-abort and panic-unwind test)So, does this imply that there is some missing test coverage, i.e. a test that demonstrates how now correctly removing
bb
from loop headers enables some jump threading to proceed?(At least, I assume no other tests were affected by this change. But I have not confirmed that.)
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.
(I'm still going to r+ the PR as is, because the missing test, I think, only represents a failure to demonstrate a newly present optimization opportunity, which while nice to have in tests, is not as important as tests that are catching potential soundness issues in the transformation.)
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 correction is a change in the definition. The restriction on loop headers is purely heuristic, and has no impact on soundness. LLVM does not like irreducible loops, so we avoid creating them.
The DFA test means precisely to capture this, but was overlooked. With a845bac it should not break silently any more.