RFR: 8353842: C2: Add graph dumps before and after loop opts phase [v2]

Manuel Hässig duke at openjdk.org
Tue Apr 8 14:05:45 UTC 2025


On Tue, 8 Apr 2025 13:40:37 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> Manuel Hässig has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Also print after if loops get optimized away
>
> src/hotspot/share/opto/compile.cpp line 1862:
> 
>> 1860:   if (has_loops()) {
>> 1861:     print_method(PHASE_AFTER_LOOP_OPTS, 2);
>> 1862:   }
> 
> Isn't `has_loops()` false when we fully optimized a loop away? Maybe we can cache the earlier decision to print the "before phase" and then print the "after phase" if we printed the "before phase".

Good catch! That is indeed the case. I fixed it in [6fd228c](https://github.com/openjdk/jdk/pull/24509/commits/6fd228c453e6508176a5a8e54f24a006ae90e91d). We can use the loop opt counter to see if a loop optimization was performed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24509#discussion_r2033274748


More information about the hotspot-compiler-dev mailing list