--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerLessThanNode.java Tue Sep 24 08:54:08 2019 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerLessThanNode.java Tue Sep 24 12:47:15 2019 -0400
@@ -114,7 +114,7 @@
@Override
protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
- Constant constant, NormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
+ Constant constant, AbstractNormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
PrimitiveConstant primitive = (PrimitiveConstant) constant;
/* @formatter:off
* a NC b < c (not mirrored)
@@ -136,25 +136,14 @@
* We can handle mirroring by swapping a & b and negating the constant.
* @formatter:on
*/
- ValueNode a = mirrored ? normalizeNode.getY() : normalizeNode.getX();
- ValueNode b = mirrored ? normalizeNode.getX() : normalizeNode.getY();
long cst = mirrored ? -primitive.asLong() : primitive.asLong();
if (cst == 0) {
- if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
- return FloatLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, mirrored ^ normalizeNode.isUnorderedLess, view);
- } else {
- return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view);
- }
+ return normalizeNode.createLowerComparison(mirrored, constantReflection, metaAccess, options, smallestCompareWidth, view);
} else if (cst == 1) {
// a <= b <=> !(a > b)
- LogicNode compare;
- if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
- // since we negate, we have to reverse the unordered result
- compare = FloatLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a, mirrored == normalizeNode.isUnorderedLess, view);
- } else {
- compare = IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a, view);
- }
+ // since we negate, we have to reverse the unordered result
+ LogicNode compare = normalizeNode.createLowerComparison(!mirrored, constantReflection, metaAccess, options, smallestCompareWidth, view);
return LogicNegationNode.create(compare);
} else if (cst <= -1) {
return LogicConstantNode.contradiction();