RFR: 8324751: C2 SuperWord: Aliasing Analysis runtime check [v6]

Emanuel Peter epeter at openjdk.org
Tue Aug 12 15:45:38 UTC 2025


On Mon, 11 Aug 2025 12:15:38 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:

>> src/hotspot/share/opto/vectorization.cpp line 752:
>> 
>>> 750: //     If stride < 0:
>>> 751: //       k = (init - stride - 1) / abs(stride)
>>> 752: //       last = MAX(init, init + k * stride)
>> 
>> Suggestion:
>> 
>> //   LAST(init, stride, limit)
>> //     If stride > 0:
>> //       k = (limit - init - 1) / abs(stride)
>> //       last = MAX(init, init + k * stride)
>> //     If stride < 0:
>> //       k = (init - limit - 1) / abs(stride)
>> //       last = MIN(init, init + k * stride)
>
> Or to be a bit closer to the implementation:
> Suggestion:
> 
> //   LAST(init, stride, limit)
> //     c = stride > 0 ? 1 : -1;
> //     k = (c * (limit - init) - 1) / abs(stride)
> //     If stride > 0:
> //       last = MAX(init, init + k * stride)
> //     If stride < 0:
> //       last = MIN(init, init + k * stride)

I'll keep the first one.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24278#discussion_r2270323536


More information about the hotspot-compiler-dev mailing list