Mercurial > hg > truffle
changeset 19615:4c84fb99a850
Improve LongNodeChainTest.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 27 Feb 2015 11:49:15 +0100 |
parents | 6d4087ecf7c7 |
children | 05e8c7567fab |
files | graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LongNodeChainTest.java |
diffstat | 1 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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);