-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8342945: Replace predicate walking code in get_assertion_predicates() used for Loop Unswitching and cleaning useless Template Assertion Predicates with a predicate visitor #21918
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
Conversation
… used for Loop Unswitching and cleaning useless Template Assertion Predicates with a predicate visitor
👋 Welcome back chagedorn! A progress list of the required criteria for merging this PR into |
@chhagedorn This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 9 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
@chhagedorn The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
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.
Looks good to me.
Thanks Tobias for your review! |
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.
Looks good to me.
Thanks Roland for your review! |
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.
Looks good to me too.
Thanks Vladimir for your review! /integrate |
Going to push as commit a6c85da.
Your commit was automatically rebased without conflicts. |
@chhagedorn Pushed as commit a6c85da. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Replacing the Remaining Predicate Walking and Cloning Code
The goal is to replace and unify all the remaining custom predicate walking and cloning code currently used for:
JDK-8341977: Loop Peeling(integrated with 8341977: Replace predicate walking and cloning code for Loop Peeling with a predicate visitor #21679))JDK-8342943: Main and Post Loop(integrated with 8342943: Replace predicate walking and cloning code for main/post loops with a predicate visitor #21790)PhaseIdealLoop::get_assertion_predicates()
used for Loop Unswitching and removing useless Template Assertion Predicate (this PR)(Sections taken over from #21679 / #21790))
Single Template Assertion Predicate Check
This replacement allows us to have a single
TemplateAssertionPredicate::is_predicate()
check that is called for all predicate matching code. This enables the removal of uncommon traps for Template Assertion Predicates with JDK-8342047 which is a missing piece in order to fix the remaining problems with Assertion Predicates (JDK-8288981).Common Refactorings for all the Patches in this Series
In each of the patch, I will do similar refactoring ideas:
PhaseIdealLoop
method with call to a new (or existing) predicate visitor which extends thePredicateVisitor
interface.visit()
methods to implement the cloning and initialization of the Template Assertion Predicates.PredicateIterator
which walks through all predicates found at a loop and applies the visitor for each predicate.PredicateIterator
must make sure to connect the tail of the newly created predicate chain after the old loop entry to the target loop head.Refactorings of this Patch
PhaseIdealLoop::get_assertion_predicates()
which is used for Loop Unswitching and removing useless Template Assertion Predicates (called fromPhaseIdealLoop::collect_useful_template_assertion_predicates_for_loop()
).PhaseIdealLoop::create_new_if_for_predicate()
.This means that we first walk from the loop entry to the last Template Assertion Predicate and then start cloning them in the reverse order (which ensures that we keep the original order of the Template Assertion Predicates). I don't think that keeping the original order is a strong requirement.
Once we replace the UCTs with halt nodes, we do not require to call
create_new_if_for_predicate()
anymore and could theoretically just clone and initialize the Template Assertion Predicates in the opposite order as originally found in the graph which is easier to implement. This is currently also done for the other loop opts that require Assertion Predicates cloning/initialization. I think it's probably safe to do this for Loop Unswitching as well once we replace UCTs with halt nodes (@rwestrel what do you think?).If at some point, we need to keep the Assertion Predicate order, we can just add this functionality to the
PredicateIterator
classes. Anyhow, I'm leaving this code inclone_assertion_predicates_to_unswitched_loop()
as it is for now and revisit it later again.Thanks,
Christian
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21918/head:pull/21918
$ git checkout pull/21918
Update a local copy of the PR:
$ git checkout pull/21918
$ git pull https://git.openjdk.org/jdk.git pull/21918/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 21918
View PR using the GUI difftool:
$ git pr show -t 21918
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21918.diff
Using Webrev
Link to Webrev Comment