Skip to content

Commit bc0b09f

Browse files
committed
[GR-69144] Make FixReads mandatory if FloatingRead was run
PullRequest: graal/21979
2 parents d9ec03d + 55fa017 commit bc0b09f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases/common/FixReadsPhase.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,11 @@ public Optional<NotApplicable> notApplicableTo(GraphState graphState) {
698698
NotApplicable.when(graphState.getGuardsStage().areFrameStatesAtSideEffects(), "This phase must run after FSA"));
699699
}
700700

701+
@Override
702+
public boolean mustApply(GraphState graphState) {
703+
return graphState.requiresFutureStage(StageFlag.FIXED_READS);
704+
}
705+
701706
@Override
702707
@SuppressWarnings("try")
703708
protected void run(StructuredGraph graph, CoreProviders context) {
@@ -764,6 +769,7 @@ private static boolean verifyOnlyFixedGuards(ValueNodeInterface guardingRoot) {
764769
public void updateGraphState(GraphState graphState) {
765770
super.updateGraphState(graphState);
766771
graphState.setAfterStage(StageFlag.FIXED_READS);
772+
graphState.removeRequirementToStage(StageFlag.FIXED_READS);
767773
}
768774

769775
protected ControlFlowGraph.RecursiveVisitor<?> createVisitor(StructuredGraph graph, ScheduleResult schedule, CoreProviders context) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases/common/FloatingReadPhase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -259,6 +259,7 @@ public void updateGraphState(GraphState graphState) {
259259
super.updateGraphState(graphState);
260260
if (createFloatingReads) {
261261
graphState.setAfterStage(StageFlag.FLOATING_READS);
262+
graphState.addFutureStageRequirement(StageFlag.FIXED_READS);
262263
}
263264
}
264265

0 commit comments

Comments
 (0)