Fix calculating comparison in constant propagation

This commit is contained in:
Alexey Andreev 2023-11-25 17:23:50 +01:00
parent 6695103f49
commit 1c292f3fbe

View File

@ -465,7 +465,7 @@ public class GlobalValueNumbering implements MethodOptimization {
} }
break; break;
case COMPARE: case COMPARE:
evaluatedConstant = Float.compare(p, q); evaluatedConstant = p > q ? 1 : p < q ? -1 : p == q ? 0 : 1;
break; break;
case AND: case AND:
case OR: case OR:
@ -501,7 +501,7 @@ public class GlobalValueNumbering implements MethodOptimization {
} }
break; break;
case COMPARE: case COMPARE:
evaluatedConstant = Double.compare(p, q); evaluatedConstant = p > q ? 1 : p < q ? -1 : p == q ? 0 : 1;
break; break;
case AND: case AND:
case OR: case OR: