RFR: 8353290: C2: Refactor PhaseIdealLoop::is_counted_loop() [v13]

Kangcheng Xu kxu at openjdk.org
Wed Oct 22 19:07:37 UTC 2025


On Fri, 10 Oct 2025 08:57:19 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> Kangcheng Xu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8354383: C2: enable sinking of Type nodes out of loop
>>   
>>   Reviewed-by: chagedorn, thartmann
>>   (cherry picked from commit a2f99fd88bd03337e1ba73b413ffe4e39f3584cf)
>
> src/hotspot/share/opto/loopnode.cpp line 1750:
> 
>> 1748: 
>> 1749:   _is_valid = true;
>> 1750:   return true;
> 
> In the old code, we returned a `nullptr` from `loop_iv_incr()` and then bailed out in `is_counted_loop()`. But here we seem to set `_incr` regardless and also set `_is_valid` to true. This seems incorrect.

You're right. This is fixed.

> src/hotspot/share/opto/loopnode.hpp line 2073:
> 
>> 2071: 
>> 2072:   bool _insert_stride_overflow_limit_check = false;
>> 2073:   bool _insert_init_trip_limit_check = false;
> 
> Can you move all fields to the top? This makes it easier to find them.

Move everything except `LoopStructure _structure` to the top. `LoopStructure` must be declared before referencing.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24458#discussion_r2453081111
PR Review Comment: https://git.openjdk.org/jdk/pull/24458#discussion_r2453087070


More information about the hotspot-compiler-dev mailing list