1
1
/*
2
- * Copyright (c) 2011, 2023 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2011, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
55
55
import jdk .graal .compiler .nodes .DeoptimizeNode ;
56
56
import jdk .graal .compiler .nodes .FixedNode ;
57
57
import jdk .graal .compiler .nodes .FixedWithNextNode ;
58
+ import jdk .graal .compiler .nodes .GraphState ;
58
59
import jdk .graal .compiler .nodes .LoopBeginNode ;
59
60
import jdk .graal .compiler .nodes .LoopEndNode ;
60
61
import jdk .graal .compiler .nodes .LoopExitNode ;
@@ -333,6 +334,14 @@ private static ControlFlowGraph lookupCached(StructuredGraph graph, boolean modi
333
334
return lastCFG ;
334
335
}
335
336
}
337
+ if (graph .getLastSchedule () != null && !graph .isAfterStage (GraphState .StageFlag .FINAL_SCHEDULE )) {
338
+ /*
339
+ * There is no up to date CFG. If there is a current schedule, its CFG must also be out
340
+ * of date. So invalidate the schedule. The only exception is during cleanup phases
341
+ * after final scheduling, where we don't want to destroy that schedule.
342
+ */
343
+ graph .clearLastSchedule ();
344
+ }
336
345
return null ;
337
346
}
338
347
@@ -398,7 +407,7 @@ public EconomicMap<LoopBeginNode, LoopFrequencyData> getLocalLoopFrequencyData()
398
407
* will return the updated value. This is useful for phases to record temporary effects of
399
408
* transformations on loop frequencies, without having to recompute a CFG.
400
409
* </p>
401
- *
410
+ * <p>
402
411
* The updated frequency is a cached value local to this CFG. It is <em>not</em> persisted in
403
412
* the IR graph. Newly computed {@link ControlFlowGraph} instances will recompute a frequency
404
413
* from loop exit probabilities, they will not see this locally cached value. Persistent changes
@@ -688,7 +697,7 @@ private boolean verifyRPOInnerLoopsFirst() {
688
697
* it is not an endless loop) {@link LoopExitNode}. For every path exiting a loop a
689
698
* {@link LoopExitNode} is required. There is one exception to that rule:
690
699
* {@link DeoptimizeNode}.
691
- *
700
+ * <p>
692
701
* Graal does not mandate that a {@link DeoptimizeNode} is preceded by a {@link LoopExitNode}.
693
702
* In the following example
694
703
*
@@ -699,7 +708,7 @@ private boolean verifyRPOInnerLoopsFirst() {
699
708
* }
700
709
* }
701
710
* </pre>
702
- *
711
+ * <p>
703
712
* the IR does not have a preceding loop exit node before the deopt node. However, for regular
704
713
* control flow sinks (returns, throws, etc) like in the following example
705
714
*
@@ -710,9 +719,9 @@ private boolean verifyRPOInnerLoopsFirst() {
710
719
* }
711
720
* }
712
721
* </pre>
713
- *
722
+ * <p>
714
723
* Graal IR creates a {@link LoopExitNode} before the {@link ReturnNode}.
715
- *
724
+ * <p>
716
725
* Because of the "imprecision" in the definition a regular basic block exiting a loop and a
717
726
* "dominator tree" loop exit are not necessarily the same. If a path after a control flow split
718
727
* unconditionally flows into a deopt it is a "dominator loop exit" while a regular loop exit
@@ -810,9 +819,9 @@ private boolean rpoInnerLoopsFirst(Consumer<HIRBlock> perBasicBlockOption, Consu
810
819
/**
811
820
* Determine if sequential predecessor blocks of this block in a not-fully-canonicalized graph
812
821
* exit a loop.
813
- *
822
+ * <p>
814
823
* Example: Sequential basic block: loop exit -> invoke -> killing begin -> loopend/exit
815
- *
824
+ * <p>
816
825
* These cases cause problems in the {@link #verifyRPOInnerLoopsFirst()} loop verification of
817
826
* inner loop blocks because the granularity of loop ends and exits are not on block boundaries:
818
827
* a loop exit block can also be a loop end to an outer loop, which makes verification that the
0 commit comments