RFR: 8353290: C2: Refactor PhaseIdealLoop::is_counted_loop() [v27]
Kangcheng Xu
kxu at openjdk.org
Mon Jan 5 18:58:49 UTC 2026
On Mon, 5 Jan 2026 16:34:13 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:
>> This PR refactors `PhaseIdealLoop::is_counted_loop()` into (mostly) `CountedLoopConverter::is_counted_loop()` and `CountedLoopConverter::convert()` to decouple the detection and conversion code. This enables us to try different loop configurations easily and finally convert once a counted loop is found.
>>
>> A nested `PhaseIdealLoop::CountedLoopConverter` class is created to handle the context, but I'm not if this is the best name or place for it. Please let me know what you think.
>>
>> Blocks [JDK-8336759](https://bugs.openjdk.org/browse/JDK-8336759).
>
> Kangcheng Xu has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 49 commits:
>
> - Update license header years
> - Merge remote-tracking branch 'origin/master' into counted-loop-refactor
> - remove trailing whitespaces
> - Merge remote-tracking branch 'origin/master' into counted-loop-refactor
> - additional suggestions from code review
> - Apply suggestions from code review
>
> Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
> - fix trip counter loop-variant detection
> - fix bad merge with ctrl_is_member()
> - Merge remote-tracking branch 'origin/master' into counted-loop-refactor
>
> # Conflicts:
> # src/hotspot/share/opto/loopnode.cpp
> - Merge branch 'master' into counted-loop-refactor
> - ... and 39 more: https://git.openjdk.org/jdk/compare/4458cab4...8b5dfad6
Merged in the latest master and updated license headers. [counted-loop-refactor-old-vs-new](https://github.com/tabjy/jdk/commits/counted-loop-refactor-old-vs-new/) branch is also updated.
Please note GHA job `linux-x64 / build (debug)` is currently failing across the jdk repo due to insufficient disk space. I'll try trigger it again tomorrow.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24458#issuecomment-3711694813
More information about the hotspot-compiler-dev
mailing list