Skip to content

Commit 83a55eb

Browse files
committed
Add stamp check to UnsignedDivNode.canonicalize
1 parent b0ca267 commit 83a55eb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,15 +27,14 @@
2727
import jdk.graal.compiler.core.common.type.IntegerStamp;
2828
import jdk.graal.compiler.core.common.type.Stamp;
2929
import jdk.graal.compiler.graph.NodeClass;
30+
import jdk.graal.compiler.nodeinfo.NodeInfo;
3031
import jdk.graal.compiler.nodes.ConstantNode;
3132
import jdk.graal.compiler.nodes.NodeView;
3233
import jdk.graal.compiler.nodes.ValueNode;
3334
import jdk.graal.compiler.nodes.extended.GuardingNode;
3435
import jdk.graal.compiler.nodes.spi.CanonicalizerTool;
3536
import jdk.graal.compiler.nodes.spi.LIRLowerable;
3637
import jdk.graal.compiler.nodes.spi.NodeLIRBuilderTool;
37-
import jdk.graal.compiler.nodeinfo.NodeInfo;
38-
3938
import jdk.vm.ci.code.CodeUtil;
4039

4140
@NodeInfo(shortName = "|/|")
@@ -64,6 +63,9 @@ public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode for
6463

6564
@SuppressWarnings("unused")
6665
private static ValueNode canonical(UnsignedDivNode self, ValueNode forX, ValueNode forY, GuardingNode zeroCheck, Stamp stamp, NodeView view) {
66+
if (!(stamp instanceof IntegerStamp)) {
67+
return self != null ? self : new UnsignedDivNode(forX, forY, zeroCheck);
68+
}
6769
int bits = ((IntegerStamp) stamp).getBits();
6870
if (forX.isConstant() && forY.isConstant()) {
6971
long yConst = CodeUtil.zeroExtend(forY.asJavaConstant().asLong(), bits);

0 commit comments

Comments
 (0)