RFR: 8341328: Refactor initial Assertion Predicate creation into separate classes
Christian Hagedorn
chagedorn at openjdk.org
Tue Oct 15 13:13:11 UTC 2024
On Thu, 10 Oct 2024 09:04:21 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
> This PR refactors the initial Assertion Predicate creation (i.e. when initially creating them, not when copy/copy-updating them from existing Template Assertion Predicates).
>
> The patch includes the following changes:
> - `PhaseIdealLoop::add_template_assertion_predicate()`, `add_range_check_elimination_assertion_predicate()`and the preparation code to call it, and `clone_template_assertion_predicate()` have similar code. I tried to share the common bits with new classes:
> - `TemplateAssertionPredicateCreator`: Creates a new Template Assertion Predicate either with an UCT (done in Loop Predication) or a Halt node (done in Range Check Elimination).
> - `InitializedAssertionPredicateCreator`: Creates a new Initialized Assertion Predicate with a Halt Node. This is an existing class which provided a method to clone a Template Assertion Predicate expression and create a new Initialized Assertion Predicate with it. Now it's extended to create one without an existing template.
> - `AssertionPredicateIfCreator`: Used by both classes above and also by `clone_template_assertion_predicate()` (it clones the Assertion Predicate expression first and then just needs to create the `If`)
> - `AssertionPredicateExpressionCreator`: Create a new Assertion Predicate expression, either with an `Opaque4` (for Template Assertion Predicates) or an `OpaqueInitializedAssertionPredicate` (for Initialized Assertion Predicates).
> - Some renaming to get more consistency (e.g. use `new_control` instead of `control` or `new_ctrl`)
> - Adding new `AssertionPredicateType::FinalIv` which was missed to account for in [JDK-8335393](https://bugs.openjdk.org/browse/JDK-8335393) where a new Initialized Assertion Predicate was added for the final IV in Range Check Elimination for a special case when removing an empty main loop.
>
> Thanks,
> Christian
Thanks Tobias for your review! I agree, it ended up more on the complex side than originally anticipated.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21446#issuecomment-2413875570
More information about the hotspot-compiler-dev
mailing list