RFR: 8328528: C2 should optimize long-typed parallel iv in an int counted loop [v3]

Kangcheng Xu kxu at openjdk.org
Mon May 13 13:46:37 UTC 2024


On Thu, 18 Apr 2024 09:11:13 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Kangcheng Xu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   update comments to clarify on type casting
>
> test/hotspot/jtreg/compiler/c2/irTests/TestCountedLoopIV.java line 24:
> 
>> 22:  */
>> 23: 
>> 24: package compiler.c2.irTests;
> 
> Putting IR tests into the `irTests` directory is what we did at the beginning, when we assumed IR tests would not be widely adopted. But now it makes more sense to put this test where it belongs "thematically". I suggest you put it under `compiler/loopopts`, or even in a new subdirectory: `compiler/loopopts/parallel_iv`.
> 
> Also the name of this test could be more expressive: `TestLongParallelIvInIntCountedLoop.java`

Renamed to `compiler.loopopts.parallel_iv.TestParallelIvInIntCountedLoop`

Notice I chose *Test~Long~ParallelIvInIntCountedLoop* since it also tests int IVs.

> test/hotspot/jtreg/compiler/c2/irTests/TestCountedLoopIV.java line 63:
> 
>> 61:         int a = 0;
>> 62:         for (int i = 0; i < stop; i++) {
>> 63:             a += 0; // we unfortunately have to repeat ourselves because the operand has to be a constant
> 
> I don't understand your comment. Why is this test interesting?

The IR framework can only test against static code, and the transformation relies on strides being constants to perform constant propagation. Therefore, we have no choice but repeating the same test case multiple times with different numbers.

I added comments to clarify this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18489#discussion_r1598496880
PR Review Comment: https://git.openjdk.org/jdk/pull/18489#discussion_r1598500281


More information about the hotspot-compiler-dev mailing list