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

Roland Westrelin roland at openjdk.org
Wed Sep 25 07:29:41 UTC 2024


On Mon, 23 Sep 2024 16:55:18 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:
> 
>   omit source BasicType

src/hotspot/share/opto/loopnode.cpp line 3934:

> 3932: //    }
> 3933: //
> 3934: // so that the loop can be eliminated given that `stride_con2 / stride_con` is

In general, a loop is not eliminated after a parallel iv is found. Can you tweak the comment so it says, that in this particular example the loop can be eliminated,

src/hotspot/share/opto/loopnode.cpp line 4002:

> 4000:     // if stride_con2 is min_jint (or min_jlong, respectively) and
> 4001:     // stride_con is -1.
> 4002:     if (((stride_con2_bt == T_INT && stride_con2 == min_jint) ||

Can you use `min_signed_integer(BasicType bt)` here?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18489#discussion_r1774670503
PR Review Comment: https://git.openjdk.org/jdk/pull/18489#discussion_r1774671519


More information about the hotspot-compiler-dev mailing list