# HG changeset patch # User Thomas Wuerthinger # Date 1425034155 -3600 # Node ID 4c84fb99a850ccff571290778080f22eddbfc2b3 # Parent 6d4087ecf7c7fec5144caf6bc7b6d8a502193cd7 Improve LongNodeChainTest. diff -r 6d4087ecf7c7 -r 4c84fb99a850 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LongNodeChainTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LongNodeChainTest.java Fri Feb 27 11:47:14 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LongNodeChainTest.java Fri Feb 27 11:49:15 2015 +0100 @@ -41,12 +41,28 @@ @Ignore @Test public void testLongAddChain() { + longAddChain(true); + longAddChain(false); + } + + private void longAddChain(boolean reverse) { HighTierContext context = new HighTierContext(getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL); StructuredGraph graph = new StructuredGraph(AllowAssumptions.NO); ValueNode constant = graph.unique(ConstantNode.forPrimitive(JavaConstant.INT_1)); - ValueNode value = constant; - for (int i = 0; i < N; ++i) { - value = graph.unique(new AddNode(constant, value)); + ValueNode value = null; + if (reverse) { + AddNode addNode = graph.unique(new AddNode(constant, constant)); + value = addNode; + for (int i = 1; i < N; ++i) { + AddNode newAddNode = graph.addWithoutUnique(new AddNode(constant, constant)); + addNode.setY(newAddNode); + addNode = newAddNode; + } + } else { + value = constant; + for (int i = 0; i < N; ++i) { + value = graph.unique(new AddNode(constant, value)); + } } ReturnNode returnNode = graph.add(new ReturnNode(value)); graph.start().setNext(returnNode);