< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.loop/src/org/graalvm/compiler/loop/LoopFragmentInside.java

Print this page
rev 56282 : [mq]: graal

*** 69,80 **** import org.graalvm.compiler.nodes.calc.IntegerBelowNode; import org.graalvm.compiler.nodes.calc.SubNode; import org.graalvm.compiler.nodes.extended.OpaqueNode; import org.graalvm.compiler.nodes.memory.MemoryPhiNode; import org.graalvm.compiler.nodes.util.GraphUtil; ! ! import jdk.vm.ci.code.CodeUtil; public class LoopFragmentInside extends LoopFragment { /** * mergedInitializers. When an inside fragment's (loop)ends are merged to create a unique exit --- 69,79 ---- import org.graalvm.compiler.nodes.calc.IntegerBelowNode; import org.graalvm.compiler.nodes.calc.SubNode; import org.graalvm.compiler.nodes.extended.OpaqueNode; import org.graalvm.compiler.nodes.memory.MemoryPhiNode; import org.graalvm.compiler.nodes.util.GraphUtil; ! import org.graalvm.compiler.nodes.util.IntegerHelper; public class LoopFragmentInside extends LoopFragment { /** * mergedInitializers. When an inside fragment's (loop)ends are merged to create a unique exit
*** 204,225 **** if (opaque == null) { opaque = new OpaqueNode(AddNode.add(counterStride, counterStride, NodeView.DEFAULT)); ValueNode limit = counted.getLimit(); int bits = ((IntegerStamp) limit.stamp(NodeView.DEFAULT)).getBits(); ValueNode newLimit = SubNode.create(limit, opaque, NodeView.DEFAULT); LogicNode overflowCheck; ConstantNode extremum; if (counted.getDirection() == InductionVariable.Direction.Up) { // limit - counterStride could overflow negatively if limit - min < // counterStride ! extremum = ConstantNode.forIntegerBits(bits, CodeUtil.minValue(bits)); overflowCheck = IntegerBelowNode.create(SubNode.create(limit, extremum, NodeView.DEFAULT), opaque, NodeView.DEFAULT); } else { assert counted.getDirection() == InductionVariable.Direction.Down; // limit - counterStride could overflow if max - limit < -counterStride // i.e., counterStride < limit - max ! extremum = ConstantNode.forIntegerBits(bits, CodeUtil.maxValue(bits)); overflowCheck = IntegerBelowNode.create(opaque, SubNode.create(limit, extremum, NodeView.DEFAULT), NodeView.DEFAULT); } newLimit = ConditionalNode.create(overflowCheck, extremum, newLimit, NodeView.DEFAULT); CompareNode compareNode = (CompareNode) counted.getLimitTest().condition(); compareNode.replaceFirstInput(limit, graph.addOrUniqueWithInputs(newLimit)); --- 203,225 ---- if (opaque == null) { opaque = new OpaqueNode(AddNode.add(counterStride, counterStride, NodeView.DEFAULT)); ValueNode limit = counted.getLimit(); int bits = ((IntegerStamp) limit.stamp(NodeView.DEFAULT)).getBits(); ValueNode newLimit = SubNode.create(limit, opaque, NodeView.DEFAULT); + IntegerHelper helper = counted.getCounterIntegerHelper(); LogicNode overflowCheck; ConstantNode extremum; if (counted.getDirection() == InductionVariable.Direction.Up) { // limit - counterStride could overflow negatively if limit - min < // counterStride ! extremum = ConstantNode.forIntegerBits(bits, helper.minValue()); overflowCheck = IntegerBelowNode.create(SubNode.create(limit, extremum, NodeView.DEFAULT), opaque, NodeView.DEFAULT); } else { assert counted.getDirection() == InductionVariable.Direction.Down; // limit - counterStride could overflow if max - limit < -counterStride // i.e., counterStride < limit - max ! extremum = ConstantNode.forIntegerBits(bits, helper.maxValue()); overflowCheck = IntegerBelowNode.create(opaque, SubNode.create(limit, extremum, NodeView.DEFAULT), NodeView.DEFAULT); } newLimit = ConditionalNode.create(overflowCheck, extremum, newLimit, NodeView.DEFAULT); CompareNode compareNode = (CompareNode) counted.getLimitTest().condition(); compareNode.replaceFirstInput(limit, graph.addOrUniqueWithInputs(newLimit));
< prev index next >