< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/LogicNode.java
Print this page
*** 89,96 ****
--- 89,108 ----
*
* @param thisNegated whether this condition should be considered as false.
* @param other the other condition.
*/
public TriState implies(boolean thisNegated, LogicNode other) {
+ if (this == other) {
+ return TriState.get(!thisNegated);
+ }
+ if (other instanceof LogicNegationNode) {
+ return flip(this.implies(thisNegated, ((LogicNegationNode) other).getValue()));
+ }
return TriState.UNKNOWN;
}
+
+ private static TriState flip(TriState triState) {
+ return triState.isUnknown()
+ ? triState
+ : TriState.get(!triState.toBoolean());
+ }
}
< prev index next >