@@ -205,7 +205,9 @@ public static class PhaseOptions {
205
205
@ Option (help = "Exclude certain phases from compilation based on the given phase filter(s)." + PhaseFilterKey .HELP , type = OptionType .Debug )
206
206
public static final PhaseFilterKey CompilationExcludePhases = new PhaseFilterKey (null , null );
207
207
@ Option (help = "Report hot metrics after each phase matching the given phase filter(s)." , type = OptionType .Debug )
208
- public static final PhaseFilterKey ReportHotMetricsAfterPhases = new PhaseFilterKey ("DominatorBasedGlobalValueNumberingPhase=*" , null );
208
+ public static final PhaseFilterKey ReportHotMetricsAfterPhases = new PhaseFilterKey (null , null );
209
+ @ Option (help = "Report hot metrics before each phase matching the given phase filter(s)." , type = OptionType .Debug )
210
+ public static final PhaseFilterKey ReportHotMetricsBeforePhases = new PhaseFilterKey ("HighTierLoweringPhase=*" , null );
209
211
@ Option (help = "Report hot metrics extracted from compiler IR." , type = OptionType .Debug )
210
212
public static final OptionKey <Boolean > ReportHotMetrics = new OptionKey <>(false );
211
213
// @formatter:on
@@ -454,6 +456,15 @@ public final void apply(final StructuredGraph graph, final C context, final bool
454
456
dumpedBefore = dumpBefore (graph , context , isTopLevel , true );
455
457
}
456
458
459
+ if (PhaseOptions .ReportHotMetrics .getValue (options ) && PhaseOptions .ReportHotMetricsBeforePhases .matches (options , this , graph )) {
460
+ // if there is a method filter set we must also match that one
461
+ if (graph .getDebug ().methodFilterMatchesCurrentMethod ()) {
462
+ String label = graph .name != null ? graph .name : graph .method ().format ("%H.%n(%p)" );
463
+ TTY .println ("Reporting hot metrics before " + getName () + " during compilation of " + label );
464
+ new ReportHotCodePhase ().apply (graph , context );
465
+ }
466
+ }
467
+
457
468
// This is a manual version of a try/resource pattern since the close operation might
458
469
// want to know whether the run call completed with an exception or not.
459
470
ApplyScope applyScope = applyScope (graph , context );
@@ -501,9 +512,12 @@ public final void apply(final StructuredGraph graph, final C context, final bool
501
512
}
502
513
503
514
if (PhaseOptions .ReportHotMetrics .getValue (options ) && PhaseOptions .ReportHotMetricsAfterPhases .matches (options , this , graph )) {
504
- String label = graph .name != null ? graph .name : graph .method ().format ("%H.%n(%p)" );
505
- TTY .println ("Reporting hot metrics after " + getName () + " during compilation of " + label );
506
- new ReportHotCodePhase ().apply (graph , context );
515
+ // if there is a method filter set we must also match that one
516
+ if (graph .getDebug ().methodFilterMatchesCurrentMethod ()) {
517
+ String label = graph .name != null ? graph .name : graph .method ().format ("%H.%n(%p)" );
518
+ TTY .println ("Reporting hot metrics after " + getName () + " during compilation of " + label );
519
+ new ReportHotCodePhase ().apply (graph , context );
520
+ }
507
521
}
508
522
509
523
} catch (Throwable t ) {
0 commit comments