Integrated: 8344035: Replace predicate walking code in Loop Unswitching with a predicate visitor

Christian Hagedorn chagedorn at openjdk.org
Mon Jan 13 08:11:47 UTC 2025


On Thu, 19 Dec 2024 13:56:41 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> This patch is a follow up to the clean-ups done with [JDK-8342945](https://bugs.openjdk.org/browse/JDK-8342945) and introduces a new predicate visitor for Loop Unswitching to update the last remaining custom predicate cloning code.
> 
> This patch includes the following:
> 
> - New `CloneUnswitchedLoopPredicatesVisitor` class which delegates the cloning work to a new `ClonePredicateToTargetLoop` class.
>   - We walk the predicate chain in the `PredicateIterator` and call the `CloneUnswitchedLoopPredicatesVisitor` for each visited predicate. Then we clone the predicate on the fly to the target loop.
> - New `ClonePredicateToTargetLoop` class:
>   - Clones Parse Predicates
>   - Clones Template Assertion Predicates
>     - Includes rewiring of control dependent data nodes
>   - Rewires the cloned predicates to the target loop with new `TargetLoopPredicateChain` class:
>     - Keeps track of the current chain head, which is the target loop itself when the chain is still empty.
>     - Each time a new predicate is inserted at the target loop, the old predicate chain head is set as output of the new predicate.
>     - An example is shown as class comment at `TargetLoopPredicateChain`.
>     - I plan to reuse this class later again when also updating `CreateAssertionPredicatesVisitor` which is done when we tackle the actual still remaining Assertion Predicate bugs.
> - Removal of custom predicate cloning code found in `PhaseIdealLoop`.
> - Changed steps performed in Loop Unswitching from:
>   1. Clone loop
>   2. Clone predicates and insert them below the unswitched loop selector If projections
>   3. Connect the cloned predicates to the unswitched loops
> 
>   to:
> 
>   1. Clone loop
>   2. Connect unswitched loop selector If projections to unswitched loops such that they are now the new loop entries
>   3. Clone predicates and insert them between the unswitched loop selector If projections and the unswitched loops
> - Rename/update `get_template_assertion_predicates()`/`TemplateAssertionPredicateCollector` to reflect the only use left.
> 
> Thanks,
> Christian

This pull request has now been integrated.

Changeset: ed0b5556
Author:    Christian Hagedorn <chagedorn at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ed0b5556276cd8bb5e4a4d1f34a49c4442e2a34e
Stats:     443 lines in 7 files changed: 227 ins; 190 del; 26 mod

8344035: Replace predicate walking code in Loop Unswitching with a predicate visitor

Reviewed-by: roland, kvn

-------------

PR: https://git.openjdk.org/jdk/pull/22828


More information about the hotspot-compiler-dev mailing list