RFR: 8344035: Replace predicate walking code in Loop Unswitching with a predicate visitor [v2]
Christian Hagedorn
chagedorn at openjdk.org
Mon Jan 6 10:08:13 UTC 2025
> 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
Christian Hagedorn has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
- Merge branch 'master' into JDK-8344035
- 8344035: Replace predicate walking code in Loop Unswitching with a predicate visitor
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/22828/files
- new: https://git.openjdk.org/jdk/pull/22828/files/9cc2db29..acc729f9
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=22828&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=22828&range=00-01
Stats: 17581 lines in 483 files changed: 13245 ins; 2540 del; 1796 mod
Patch: https://git.openjdk.org/jdk/pull/22828.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22828/head:pull/22828
PR: https://git.openjdk.org/jdk/pull/22828
More information about the hotspot-compiler-dev
mailing list