RFR: 8346552: C2: Add IR tests to check that Predicate cloning in Loop Unswitching works as expected [v3]
Manuel Hässig
duke at openjdk.org
Thu Apr 17 06:23:34 UTC 2025
On Thu, 10 Apr 2025 14:25:21 GMT, Manuel Hässig <duke at openjdk.org> wrote:
>> # 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 refreshed the contents of this pull request, and previous commits have been removed. Incremental views are not available.
Changes since v3:
- Changed issue and PR title
- Only clone Loop Limit Checks if an uncounted loop is unswitched
- Add IR test for unswitching an uncounted loop
- Add IR test where a counted loop is predicated before it is unswitched
- Randomize the tests
- Updated branch to master
I also reran testing.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24479#issuecomment-2810194364
More information about the hotspot-compiler-dev
mailing list