RFR: 8330158: C2: Loop strip mining uses ABS with min int [v2]

Roland Westrelin roland at openjdk.org
Fri Apr 19 12:59:17 UTC 2024


On Wed, 17 Apr 2024 16:14:28 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   more
>
> src/hotspot/share/opto/loopnode.cpp line 2969:
> 
>> 2967:   int scaled_iters = (int)scaled_iters_long;
>> 2968:   if ((jlong)scaled_iters != scaled_iters_long) {
>> 2969:     // Remove outer loop and safepoint (too few iterations)
> 
> Please put more extended comment here. What you have in PR description would be nice.

I added a comment. Does it look good to you?

> src/hotspot/share/opto/loopnode.cpp line 2973:
> 
>> 2971:     return;
>> 2972:   }
>> 2973:   int short_scaled_iters = LoopStripMiningIterShortLoop * ABS(stride);
> 
> So stride is not MIN_INT here but the expression still can overflow. Should we use `jlong` for expression and `short_scaled_iters`? `iter_estimate` is `jlong`.

Good catch. I updated the patch as suggested.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18813#discussion_r1572326967
PR Review Comment: https://git.openjdk.org/jdk/pull/18813#discussion_r1572327289


More information about the hotspot-compiler-dev mailing list