RFR: 8356176: C2 MemorySegment: missing RCE with byteSize() in Loop Exit Check inside the for Expression

Manuel Hässig mhaessig at openjdk.org
Wed Jul 30 12:05:38 UTC 2025


On Thu, 24 Jul 2025 08:08:16 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/opto/loopnode.hpp line 1660:
>> 
>>> 1658:     }
>>> 1659:     bool profitable(uint policy) const {
>>> 1660:       return _total_wins >= policy && !(_backedge_wins == 0 && _entry_wins > 0);
>> 
>> I think this should be `(_entry_wins == 0 && _total_wins >= policy) || _backedge_wins >= policy`.
>
> My bad, since the original negative condition is `wins <= policy`, this should be `(_entry_wins == 0 && _total_wins > policy) || _backedge_wins > policy`. Fixing this solves all the issues in GHA.

Can confirm. This also seems to solve JDK-8331659 and JDK-8332878.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26429#discussion_r2228283016


More information about the hotspot-compiler-dev mailing list