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
Tue Apr 22 13:28:58 UTC 2025


On Tue, 22 Apr 2025 11:39:57 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> 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
>
> test/hotspot/jtreg/compiler/loopopts/TestUnswitchPredicateCloning.java line 139:
> 
>> 137:                    IRNode.LOOP_LIMIT_CHECK_PARSE_PREDICATE, "1",
>> 138:                    IRNode.AUTO_VECTORIZATION_CHECK_PARSE_PREDICATE, "2" },
>> 139:         phase = CompilePhase.BEFORE_LOOP_PREDICATION_IC)
> 
> This suggests that we apply another round of Loop Predication later? It might be confused with the first application of Loop Predication. Could we also match on `PHASEIDEALLOOP_ITERATIONS` instead? Would that work?

`PHASEIDEALLOOP_ITERATIONS` does not work reliably. I decided to go with `PHASEIDEALLOOP2`, which does work reliably.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24479#discussion_r2054109164


More information about the hotspot-compiler-dev mailing list