RFR: 8346552: C2: Add IR tests to check that Predicate cloning in Loop Unswitching works as expected [v4]
Manuel Hässig
duke at openjdk.org
Thu Apr 17 06:23:33 UTC 2025
> # Issue Summary
>
> When a loop is unswitched, all parse predicates from the original loop must be cloned to the second loop that is created. Forgetting to clone a parse predicate is a common error during development on loop unswitching code that we could not catch previously. Since we have the IR-framework now, this PR introduces a test to catch this error.
>
> # Changes
>
> The main contribution of this PR is a test to ensure that all predicates have been cloned into an unswitched loop. This also required some relating changes:
> - add `OPAQUE_TEMPLATE_ASSERTION_PREDICATE_NODE` to the IR-framework,
> - add some missing parse predicate nodes to the IR-framework,
> - change the output of the labels of parse predicate nodes in the ideal graph so they can be recognized reliably by the IR-framework (the main problem was that `Loop ` is a prefix of `Loop Limit Check` that is hard to distinguish with spaces instead of underlines),
> - rework the regex for detecting parse predicates in the IR-framework,
> - add a test to ensure parse predicates are cloned into unswitched loops.
>
> # Testing
>
> - [Github Actions](https://github.com/mhaessig/jdk/actions/runs/14266369099)
> - tier1 through tier3 plus Oracle internal testing
Manuel Hässig has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 13 commits:
- Make test random
- Add test for predicate cloning on uncounted loops
- Add test case for predication before unswitching
- Test predicate cloning only before loop predication
Thus, we do not see the predicates in the loop selector that cloning
actually killed.
- Clone loop limit predicates for uncounted loops
When unswitching uncounted loops we have to clone loop limit checks
because we do not have information on the behavior of the loop index
- Do not clone loop limit checks in loop unswitching
- Add suggested comment
Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
- Remove -Xcomp and replace with Warmup(0)
- ir-framework: use new before/after loop opts phases
- Add IR test for predicate cloning
- ... and 3 more: https://git.openjdk.org/jdk/compare/465c8e65...17b32db4
-------------
Changes: https://git.openjdk.org/jdk/pull/24479/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24479&range=03
Stats: 223 lines in 5 files changed: 215 ins; 1 del; 7 mod
Patch: https://git.openjdk.org/jdk/pull/24479.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24479/head:pull/24479
PR: https://git.openjdk.org/jdk/pull/24479
More information about the hotspot-compiler-dev
mailing list