Skip to content

Commit 607caec

Browse files
committed
[GR-52532] Backport to 24.0: Deprecate ZeroExtendNode.inputAlwaysPositive.
PullRequest: graal/17188
2 parents d1d77f3 + 4dc78b3 commit 607caec

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/amd64/AMD64HotSpotAddressLowering.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ private static ValueNode signExtend(ValueNode input, LoopEx loop) {
187187
if (init >= 0 && extremum >= 0) {
188188
long shortestTrip = (extremum - init) / stride + 1;
189189
if (countedLoopInfo.constantMaxTripCount().equals(shortestTrip)) {
190-
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, true));
190+
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, false));
191191
}
192192
}
193193
}
194194
if (countedLoopInfo.getLimitCheckedIV() == inductionVariable &&
195195
inductionVariable.direction() == InductionVariable.Direction.Up &&
196196
(countedLoopInfo.getOverFlowGuard() != null || countedLoopInfo.counterNeverOverflows())) {
197-
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, true));
197+
return graph.unique(new ZeroExtendNode(input, INT_BITS, ADDRESS_BITS, false));
198198
}
199199
}
200200
}

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/calc/SignExtendNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private static ValueNode canonical(SignExtendNode self, ValueNode forValue, int
124124
if ((inputStamp.mayBeSet() & (1L << (inputBits - 1))) == 0L) {
125125
// 0xxx -(sign-extend)-> 0000 0xxx
126126
// ==> 0xxx -(zero-extend)-> 0000 0xxx
127-
return ZeroExtendNode.create(forValue, inputBits, resultBits, view, true);
127+
return ZeroExtendNode.create(forValue, inputBits, resultBits, view, false);
128128
}
129129
}
130130
if (forValue instanceof NarrowNode) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/calc/ZeroExtendNode.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import jdk.graal.compiler.core.common.type.PrimitiveStamp;
3636
import jdk.graal.compiler.core.common.type.Stamp;
3737
import jdk.graal.compiler.debug.Assertions;
38+
import jdk.graal.compiler.debug.GraalError;
3839
import jdk.graal.compiler.graph.NodeClass;
3940
import jdk.graal.compiler.lir.gen.ArithmeticLIRGeneratorTool;
4041
import jdk.graal.compiler.nodeinfo.NodeInfo;
@@ -67,14 +68,15 @@ public ZeroExtendNode(ValueNode input, int resultBits) {
6768
public ZeroExtendNode(ValueNode input, int inputBits, int resultBits, boolean inputAlwaysPositive) {
6869
super(TYPE, BinaryArithmeticNode.getArithmeticOpTable(input).getZeroExtend(), inputBits, resultBits, input);
6970
this.inputAlwaysPositive = inputAlwaysPositive;
71+
GraalError.guarantee(!inputAlwaysPositive, "ZeroExtendNode.inputAlwaysPositive is deprecated.");
7072
}
7173

7274
public static ValueNode create(ValueNode input, int resultBits, NodeView view) {
73-
return create(input, PrimitiveStamp.getBits(input.stamp(view)), resultBits, view, inputAlwaysPositive(input));
75+
return create(input, PrimitiveStamp.getBits(input.stamp(view)), resultBits, view, false);
7476
}
7577

7678
public static ValueNode create(ValueNode input, int inputBits, int resultBits, NodeView view) {
77-
return create(input, inputBits, resultBits, view, inputAlwaysPositive(input));
79+
return create(input, inputBits, resultBits, view, false);
7880
}
7981

8082
public static ValueNode create(ValueNode input, int inputBits, int resultBits, NodeView view, boolean alwaysPositive) {
@@ -86,15 +88,6 @@ public static ValueNode create(ValueNode input, int inputBits, int resultBits, N
8688
return canonical(null, input, inputBits, resultBits, view, alwaysPositive);
8789
}
8890

89-
private static boolean inputAlwaysPositive(ValueNode v) {
90-
Stamp s = v.stamp(NodeView.DEFAULT);
91-
if (s instanceof IntegerStamp) {
92-
return ((IntegerStamp) s).isPositive();
93-
} else {
94-
return false;
95-
}
96-
}
97-
9891
@Override
9992
protected IntegerConvertOp<ZeroExtend> getOp(ArithmeticOpTable table) {
10093
return table.getZeroExtend();

0 commit comments

Comments
 (0)