RFR: 8361702: C2: assert(is_dominator(compute_early_ctrl(limit, limit_ctrl), pre_end)) failed: node pinned on loop exit test? [v7]
Emanuel Peter
epeter at openjdk.org
Tue Sep 9 12:00:02 UTC 2025
On Tue, 9 Sep 2025 08:39:37 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> A node in a pre loop only has uses out of the loop dominated by the
>> loop exit. `PhaseIdealLoop::try_sink_out_of_loop()` sets its control
>> to the loop exit projection. A range check in the main loop has this
>> node as input (through a chain of some other nodes). Range check
>> elimination needs to update the exit condition of the pre loop with an
>> expression that depends on the node pinned on its exit: that's
>> impossible and the assert fires. This is a variant of 8314024 (this
>> one was for a node with uses out of the pre loop on multiple paths). I
>> propose the same fix: leave the node with control in the pre loop in
>> this case.
>
> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
>
> - Merge branch 'master' into JDK-8361702
> - Merge branch 'master' into JDK-8361702
> - review
> - Merge branch 'master' into JDK-8361702
> - Update src/hotspot/share/opto/loopopts.cpp
>
> Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
> - Update test/hotspot/jtreg/compiler/rangechecks/TestSunkRangeFromPreLoopRCE3.java
>
> Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
> - Update test/hotspot/jtreg/compiler/rangechecks/TestSunkRangeFromPreLoopRCE2.java
>
> Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
> - Update src/hotspot/share/opto/loopopts.cpp
>
> Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
> - Update test/hotspot/jtreg/compiler/rangechecks/TestSunkRangeFromPreLoopRCE2.java
>
> Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
> - tests
> - ... and 1 more: https://git.openjdk.org/jdk/compare/2676c5f4...91a7d73c
src/hotspot/share/opto/loopopts.cpp line 1936:
> 1934: // Sinking a node from a pre loop to its main loop pins the node between the pre and main loops. If that node is input
> 1935: // to a check that's eliminated by range check elimination, it becomes input to an expression that feeds into the exit
> 1936: // test of the pre loop above the point in the graph where it's pinned.
I guess the alternative would have been not to do that RC elimination, right?
If yes: you could finish the thought and say that we prefer to have a chance at RC elimination, rather than sinking the node out of the pre-loop.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26424#discussion_r2333262985
More information about the hotspot-compiler-dev
mailing list