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

Emanuel Peter epeter at openjdk.org
Thu Jun 13 18:45:21 UTC 2024


On Wed, 15 May 2024 16:01:54 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:

>> Currently, parallel iv optimization only happens in an int counted loop with int-typed parallel iv's. This PR adds support for long-typed iv to be optimized. 
>> 
>> Additionally, this ticket contributes to the resolution of [JDK-8275913](https://bugs.openjdk.org/browse/JDK-8275913). Meanwhile, I'm working on adding support for parallel IV replacement for long counted loops which will depend on this PR.
>
> Kangcheng Xu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix tests on larger strides

test/hotspot/jtreg/compiler/loopopts/parallel_iv/TestParallelIvInIntCountedLoop.java line 40:

> 38:  * @summary test the long typed parallel iv replacing transformation for int counted loop
> 39:  * @library /test/lib /
> 40:  * @run main compiler.loopopts.parallel_iv.TestParallelIvInIntCountedLoop

Suggestion:

 * @run driver compiler.loopopts.parallel_iv.TestParallelIvInIntCountedLoop

We want the flags to be passed to the IR test vm. But the driver VM does not need to have the flags passed.
General rule: normal tests we have `main`, so the flags are passed to the VM. But with IR tests we do `driver`, so that the driver VM does not get the tests passed - the test VM looks at the passed flags via the IR framework.

test/hotspot/jtreg/compiler/loopopts/parallel_iv/TestParallelIvInIntCountedLoop.java line 51:

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

That is not exactly true. You could create a `static final` field that gets its value assigned randomly. This would then be a constant once the code is JIT-ed. Just an idea if you want to expand your testing with some random numbers.

test/hotspot/jtreg/compiler/loopopts/parallel_iv/TestParallelIvInIntCountedLoop.java line 54:

> 52:      */
> 53:     @Test
> 54:     @Arguments(values = {Argument.DEFAULT})

Lazy question from my side:
Can you remind me what is the value of `DEFAULT`? Why are you choosing that?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18489#discussion_r1638723490
PR Review Comment: https://git.openjdk.org/jdk/pull/18489#discussion_r1638725652
PR Review Comment: https://git.openjdk.org/jdk/pull/18489#discussion_r1638726573


More information about the hotspot-compiler-dev mailing list