RFR: 8366861: Phase AFTER_LOOP_OPTS printed even though the method has no loops

Christian Hagedorn chagedorn at openjdk.org
Mon Jan 26 07:49:29 UTC 2026


On Fri, 23 Jan 2026 12:41:25 GMT, Saranya Natarajan <snatarajan at openjdk.org> wrote:

> **Issue**
> When a test program with no loop is run with flag `-XX:PrintPhaseLevel=3,` the output prints `PHASE_AFTER_LOOP_OPTS `but does not print `PHASE_BEFORE_LOOP_OPTS`
> 
> **Solution** 
> This simple fix introduces a variable  `_print_phase_loop_opts` that caches the value of `has_loops()` before loop opts pass to make sure that `PHASE_AFTER_LOOP_OPTS` gets printed every time `PHASE_BEFORE_LOOP_OPTS` is printed.
> 
> Before fix output
> <img width="394" height="608" alt="image" src="https://github.com/user-attachments/assets/753001da-a020-45cc-9db1-00f9c9c79bd2" />
> 
> After fix output
> <img width="394" height="608" alt="image" src="https://github.com/user-attachments/assets/cc49854f-afa1-42a9-a87c-9f763f7daeb4" />
> 
> 
> **Testing** 
>  Github Actions, Tier 1-3

Looks good, thanks for cleaning that up!

src/hotspot/share/opto/compile.hpp line 358:

> 356:   bool                  _print_inlining;        // True if we should print inlining for this compilation
> 357:   bool                  _print_intrinsics;      // True if we should print intrinsics for this compilation
> 358:   bool                  _print_phase_loop_opts; // True if we should before and after print phase loop opts

Suggestion:

  bool                  _print_phase_loop_opts; // True if we should print before and after loop opts phase

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/29387#pullrequestreview-3704918904
PR Review Comment: https://git.openjdk.org/jdk/pull/29387#discussion_r2726614451


More information about the hotspot-compiler-dev mailing list