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

Kangcheng Xu kxu at openjdk.org
Mon Jul 22 20:43:34 UTC 2024


On Mon, 22 Jul 2024 17:40:48 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:
> 
>   use @run driver and Argument.RANDOM_ONCE

I'm observing a weird test [failure exposed by GHA](https://github.com/tabjy/jdk/actions/runs/10045677996/job/27764679129) that only happens on Linux x86. While there are no actual loop nodes, `LoopLimit` nodes are matched by the same regex. I'm currently looking into this:

- `LoopLimit` nodes are somehow not eliminated together with counted loops on 32bit Linux
- the same binary bundle downloaded from GHA running on my local machine produces only one failure (instead of two) on `testIntCountedLoopWithIntIVWithRandomStrides(int)`
- `LoopLimit` and `/(\d+(\s){2}(Loop.*)+(\s){2}===.*)/` being another case of [regex mis-match](https://github.com/openjdk/jdk/pull/18198#issuecomment-2214675206)?


2024-07-22T18:16:53.5547051Z One or more @IR rules failed:
2024-07-22T18:16:53.5547411Z 
2024-07-22T18:16:53.5547613Z Failed IR Rules (2) of Methods (2)
2024-07-22T18:16:53.5548249Z ----------------------------------
2024-07-22T18:16:53.5550118Z 1) Method "private static int compiler.loopopts.parallel_iv.TestParallelIvInIntCountedLoop.testIntCountedLoopWithIntIVWithRandomStrides(int)" - [Failed IR rules: 1]:
2024-07-22T18:16:53.5553610Z    * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={}, failOn={"_#LOOP#_", "_#COUNTED_LOOP#_"}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
2024-07-22T18:16:53.5556263Z      > Phase "PrintIdeal":
2024-07-22T18:16:53.5557150Z        - failOn: Graph contains forbidden nodes:
2024-07-22T18:16:53.5557912Z          * Constraint 1: "(\d+(\s){2}(Loop.*)+(\s){2}===.*)"
2024-07-22T18:16:53.5558668Z            - Matched forbidden node:
2024-07-22T18:16:53.5559308Z              * 127  LoopLimit  === _ 22 10 83  [[ 128 ]] 
2024-07-22T18:16:53.5559791Z 
2024-07-22T18:16:53.5561343Z 2) Method "private static long compiler.loopopts.parallel_iv.TestParallelIvInIntCountedLoop.testIntCountedLoopWithLongIVWithRandomStrides(int)" - [Failed IR rules: 1]:
2024-07-22T18:16:53.5565173Z    * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={}, failOn={"_#LOOP#_", "_#COUNTED_LOOP#_"}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
2024-07-22T18:16:53.5567518Z      > Phase "PrintIdeal":
2024-07-22T18:16:53.5568180Z        - failOn: Graph contains forbidden nodes:
2024-07-22T18:16:53.5568932Z          * Constraint 1: "(\d+(\s){2}(Loop.*)+(\s){2}===.*)"
2024-07-22T18:16:53.5569677Z            - Matched forbidden node:
2024-07-22T18:16:53.5570302Z              * 132  LoopLimit  === _ 23 10 86  [[ 133 ]] 
2024-07-22T18:16:53.5570781Z 
2024-07-22T18:16:53.5571114Z >>> Check stdout for compilation output of the failed methods

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

PR Comment: https://git.openjdk.org/jdk/pull/18489#issuecomment-2243777980


More information about the hotspot-compiler-dev mailing list