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

Kangcheng Xu kxu at openjdk.org
Mon Jun 16 15:25:53 UTC 2025


> 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 22 commits:

 - Merge branch 'master' into counted-loop-refactor
   
   # Conflicts:
   #	src/hotspot/share/opto/loopnode.cpp
   #	src/hotspot/share/opto/loopnode.hpp
   #	src/hotspot/share/opto/loopopts.cpp
 - Merge remote-tracking branch 'origin/master' into counted-loop-refactor
 - further refactor is_counted_loop() by extracting functions
 - WIP: refactor is_counted_loop()
 - WIP: refactor is_counted_loop()
 - WIP: review followups
 - reviewer suggested changes
 - line break
 - remove TODOs
 - Revert "improve formatting, naming, comments"
   
   This reverts commit fd6071761bdc47ab5695559dffd1e1dd6038d9f7.
 - ... and 12 more: https://git.openjdk.org/jdk/compare/9d060574...fd93998b

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

Changes: https://git.openjdk.org/jdk/pull/24458/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24458&range=05
  Stats: 924 lines in 3 files changed: 418 ins; 208 del; 298 mod
  Patch: https://git.openjdk.org/jdk/pull/24458.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24458/head:pull/24458

PR: https://git.openjdk.org/jdk/pull/24458


More information about the hotspot-compiler-dev mailing list