RFR: 8344035: Replace predicate walking code in Loop Unswitching with a predicate visitor
Christian Hagedorn
chagedorn at openjdk.org
Thu Dec 19 14:04:22 UTC 2024
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
-------------
Commit messages:
- 8344035: Replace predicate walking code in Loop Unswitching with a predicate visitor
Changes: https://git.openjdk.org/jdk/pull/22828/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22828&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8344035
Stats: 443 lines in 7 files changed: 227 ins; 190 del; 26 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