RFR: 8361608: C2: assert(opaq->outcnt() == 1 && opaq->in(1) == limit) failed [v5]

Marc Chevalier mchevalier at openjdk.org
Wed Oct 22 14:53:36 UTC 2025


On Wed, 22 Oct 2025 09:12:35 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> src/hotspot/share/opto/loopnode.cpp line 4779:
>> 
>>> 4777:         if (!head->is_pre_loop() && !head->is_post_loop()) {
>>> 4778:           assert(opaque->outcnt() == 1 && opaque->in(1) == head->limit(), "IGVN should have cleaned that up!");
>>> 4779:         }
>> 
>> I think we can just check `is_main_loop()` here. `is_canonical_loop_entry()` will bail out if we see anything else than main or post loops:
>> 
>> https://github.com/openjdk/jdk/blob/bdfd5e843a7d3db50edf4375e50449b0ce528f8a/src/hotspot/share/opto/loopnode.cpp#L6330-L6333
>> 
>> 
>> Suggestion:
>> 
>>         if (head->is_main_loop()) {
>>           assert(opaque->outcnt() == 1 && opaque->in(1) == head->limit(), "IGVN should have cleaned that up!");
>>         }
>
> Maybe you can even go a step further and also check that for the post loop, `outcnt()` is also 1 which should hold as well.

Changed and added. Is that what you had in mind? Testing seems happy, at least.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27586#discussion_r2452376350


More information about the hotspot-compiler-dev mailing list