RFR: 8353842: C2: Add graph dumps before and after loop opts phase
Christian Hagedorn
chagedorn at openjdk.org
Tue Apr 8 13:49:16 UTC 2025
On Tue, 8 Apr 2025 13:28:59 GMT, Manuel Hässig <duke at openjdk.org> wrote:
> This PR adds graph dumps before and after loop optimizations, but only if the compiled method actually contains loops. This helps to distinguish loop optimizations in IGV and to match loop related nodes like opaque template assertion predicates.
>
> I tested this by compiling a few test methods and looking at the ideal graph. Also, I ran tier1 through tier3 and Oracle internal testing.
Nice additions! These can be quite helpful during debugging as well. A few comments.
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".
test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java line 61:
> 59: ITER_GVN_BEFORE_EA("Iter GVN before EA"),
> 60: ITER_GVN_AFTER_VECTOR("Iter GVN after vector box elimination"),
> 61: BEFORE_LOOP_OPTS("Before loop optimizations"),
To match capital first letters of (most) other phases:
Suggestion:
BEFORE_LOOP_OPTS("Before Loop Optimizations"),
test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java line 99:
> 97: ITER_GVN2("Iter GVN 2"),
> 98: PHASEIDEALLOOP_ITERATIONS("PhaseIdealLoop iterations"),
> 99: AFTER_LOOP_OPTS("After loop optimizations"),
Suggestion:
AFTER_LOOP_OPTS("After Loop Optimizations"),
-------------
Changes requested by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/24509#pullrequestreview-2750030412
PR Review Comment: https://git.openjdk.org/jdk/pull/24509#discussion_r2033220837
PR Review Comment: https://git.openjdk.org/jdk/pull/24509#discussion_r2033226427
PR Review Comment: https://git.openjdk.org/jdk/pull/24509#discussion_r2033226881
More information about the hotspot-compiler-dev
mailing list