< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java
Print this page
@@ -246,11 +246,11 @@
protected final EconomicMap<MergeNode, EconomicMap<ValuePhiNode, PhiInfoElement>> mergeMaps;
/**
* Tests which may be eliminated because post dominating tests to prove a broader condition.
*/
- private Deque<PendingTest> pendingTests;
+ private Deque<DeoptimizingGuard> pendingTests;
public Instance(StructuredGraph graph, BlockMap<List<Node>> blockToNodes, PhaseContext context) {
this.graph = graph;
this.debug = graph.getDebug();
this.blockToNodes = blockToNodes;
@@ -553,11 +553,12 @@
}
}
}
}
if (guard instanceof DeoptimizingGuard) {
- pendingTests.push(new PendingTest(condition, (DeoptimizingGuard) guard));
+ assert ((DeoptimizingGuard) guard).getCondition() == condition;
+ pendingTests.push((DeoptimizingGuard) guard);
}
registerCondition(condition, negated, guard);
}
Pair<InfoElement, Stamp> recursiveFoldStamp(Node node) {
@@ -626,19 +627,20 @@
Pair<InfoElement, Stamp> recursiveFoldStampFromInfo(Node node) {
return recursiveFoldStamp(node);
}
protected boolean foldPendingTest(DeoptimizingGuard thisGuard, ValueNode original, Stamp newStamp, GuardRewirer rewireGuardFunction) {
- for (PendingTest pending : pendingTests) {
+ for (DeoptimizingGuard pendingGuard : pendingTests) {
+ LogicNode pendingCondition = pendingGuard.getCondition();
TriState result = TriState.UNKNOWN;
- if (pending.condition instanceof UnaryOpLogicNode) {
- UnaryOpLogicNode unaryLogicNode = (UnaryOpLogicNode) pending.condition;
+ if (pendingCondition instanceof UnaryOpLogicNode) {
+ UnaryOpLogicNode unaryLogicNode = (UnaryOpLogicNode) pendingCondition;
if (unaryLogicNode.getValue() == original) {
result = unaryLogicNode.tryFold(newStamp);
}
- } else if (pending.condition instanceof BinaryOpLogicNode) {
- BinaryOpLogicNode binaryOpLogicNode = (BinaryOpLogicNode) pending.condition;
+ } else if (pendingCondition instanceof BinaryOpLogicNode) {
+ BinaryOpLogicNode binaryOpLogicNode = (BinaryOpLogicNode) pendingCondition;
ValueNode x = binaryOpLogicNode.getX();
ValueNode y = binaryOpLogicNode.getY();
if (x == original) {
result = binaryOpLogicNode.tryFold(newStamp, getOtherSafeStamp(y));
} else if (y == original) {
@@ -657,11 +659,11 @@
* be moved up if we're sure there's no schedule dependence. For now limit it to
* the original node and constants.
*/
InputFilter v = new InputFilter(original);
thisGuard.getCondition().applyInputs(v);
- if (v.ok && foldGuard(thisGuard, pending.guard, newStamp, rewireGuardFunction)) {
+ if (v.ok && foldGuard(thisGuard, pendingGuard, newStamp, rewireGuardFunction)) {
return true;
}
}
}
return false;
@@ -1024,20 +1026,10 @@
* @return whether the transformation could be applied
*/
boolean rewire(GuardingNode guard, boolean result, Stamp guardedValueStamp, ValueNode newInput);
}
- protected static class PendingTest {
- private final LogicNode condition;
- private final DeoptimizingGuard guard;
-
- public PendingTest(LogicNode condition, DeoptimizingGuard guard) {
- this.condition = condition;
- this.guard = guard;
- }
- }
-
protected static final class InfoElement {
private final Stamp stamp;
private final GuardingNode guard;
private final ValueNode proxifiedInput;
private final InfoElement parent;
< prev index next >