Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public final class GraphState {
private static final EnumSet<StageFlag> LOW_TIER_MANDATORY_STAGES = EnumSet.of(
StageFlag.LOW_TIER_LOWERING,
StageFlag.EXPAND_LOGIC,
StageFlag.ADDRESS_LOWERING);
StageFlag.ADDRESS_LOWERING,
StageFlag.REMOVE_OPAQUE_VALUES);
private static final EnumSet<StageFlag> ENTERPRISE_MID_TIER_MANDATORY_STAGES = EnumSet.of(
StageFlag.VALUE_PROXY_REMOVAL,
StageFlag.SAFEPOINTS_INSERTION,
Expand Down Expand Up @@ -626,6 +627,7 @@ public enum StageFlag {
FIXED_READS,
ADDRESS_LOWERING,
FINAL_CANONICALIZATION,
REMOVE_OPAQUE_VALUES,
TARGET_VECTOR_LOWERING,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ public boolean mustApply(GraphState graphState) {

@Override
public Optional<NotApplicable> notApplicableTo(GraphState graphState) {
return NotApplicable.unlessRunBefore(this, StageFlag.FINAL_CANONICALIZATION, graphState);
return NotApplicable.ifAny(
NotApplicable.unlessRunBefore(this, StageFlag.FINAL_CANONICALIZATION, graphState),
NotApplicable.unlessRunBefore(this, StageFlag.REMOVE_OPAQUE_VALUES, graphState));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Optional;

import org.graalvm.compiler.nodes.GraphState;
import org.graalvm.compiler.nodes.GraphState.StageFlag;
import org.graalvm.compiler.nodes.StructuredGraph;
import org.graalvm.compiler.nodes.extended.OpaqueValueNode;
import org.graalvm.compiler.nodes.spi.CoreProviders;
Expand All @@ -38,7 +39,9 @@
public class RemoveOpaqueValuePhase extends BasePhase<CoreProviders> {
@Override
public Optional<NotApplicable> notApplicableTo(GraphState graphState) {
return ALWAYS_APPLICABLE;
return NotApplicable.ifAny(
NotApplicable.unlessRunAfter(this, StageFlag.LOW_TIER_LOWERING, graphState),
NotApplicable.ifApplied(this, StageFlag.REMOVE_OPAQUE_VALUES, graphState));
}

public boolean shouldApply(StructuredGraph graph) {
Expand All @@ -51,4 +54,10 @@ protected void run(StructuredGraph graph, CoreProviders context) {
opaque.replaceAtUsagesAndDelete(opaque.getValue());
}
}

@Override
public void updateGraphState(GraphState graphState) {
super.updateGraphState(graphState);
graphState.setAfterStage(StageFlag.REMOVE_OPAQUE_VALUES);
}
}