< prev index next >

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

Print this page
rev 52509 : [mq]: graal2

*** 81,99 **** } @Ignore("equality limits aren't working properly") @Test public void testSumWithEqualityLimit() { ! for (int i = 0; i < 128; i++) { int[] data = new int[i]; test("sumWithEqualityLimit", data); } } @Test public void testLoopCarried() { ! for (int i = 0; i < 64; i++) { test("testLoopCarriedSnippet", i); } } @Test --- 81,99 ---- } @Ignore("equality limits aren't working properly") @Test public void testSumWithEqualityLimit() { ! for (int i = -1; i < 128; i++) { int[] data = new int[i]; test("sumWithEqualityLimit", data); } } @Test public void testLoopCarried() { ! for (int i = -1; i < 64; i++) { test("testLoopCarriedSnippet", i); } } @Test
*** 101,111 **** testDuplicateBody("testLoopCarriedReference", "testLoopCarriedSnippet"); } static volatile int volatileInt = 3; ! public int testLoopCarriedSnippet(int iterations) { int a = 0; int b = 0; int c = 0; for (int i = 0; branchProbability(0.99, i < iterations); i++) { --- 101,111 ---- testDuplicateBody("testLoopCarriedReference", "testLoopCarriedSnippet"); } static volatile int volatileInt = 3; ! public static int testLoopCarriedSnippet(int iterations) { int a = 0; int b = 0; int c = 0; for (int i = 0; branchProbability(0.99, i < iterations); i++) {
*** 117,127 **** } return c; } ! public int testLoopCarriedReference(int iterations) { int a = 0; int b = 0; int c = 0; for (int i = 0; branchProbability(0.99, i < iterations); i += 2) { --- 117,127 ---- } return c; } ! public static int testLoopCarriedReference(int iterations) { int a = 0; int b = 0; int c = 0; for (int i = 0; branchProbability(0.99, i < iterations); i += 2) {
*** 138,147 **** --- 138,178 ---- } return c; } + @Test + public void testLoopCarried2() { + for (int i = -1; i < 64; i++) { + for (int j = -1; j < 64; j++) { + test("testLoopCarried2Snippet", i, j); + } + } + test("testLoopCarried2Snippet", Integer.MAX_VALUE - 32, Integer.MAX_VALUE); + test("testLoopCarried2Snippet", Integer.MAX_VALUE - 4, Integer.MAX_VALUE); + test("testLoopCarried2Snippet", Integer.MAX_VALUE, 0); + test("testLoopCarried2Snippet", Integer.MIN_VALUE, Integer.MIN_VALUE + 32); + test("testLoopCarried2Snippet", Integer.MIN_VALUE, Integer.MIN_VALUE + 4); + test("testLoopCarried2Snippet", 0, Integer.MIN_VALUE); + } + + public static int testLoopCarried2Snippet(int start, int end) { + int a = 0; + int b = 0; + int c = 0; + + for (int i = start; branchProbability(0.99, i < end); i++) { + int t1 = volatileInt; + int t2 = a + b; + c = b; + b = a; + a = t1 + t2; + } + + return c; + } + public static long init = Runtime.getRuntime().totalMemory(); private int x; private int z; public int[] testComplexSnippet(int d) {
*** 162,172 **** return new int[]{x, y, z}; } @Test public void testComplex() { ! for (int i = 0; i < 10; i++) { test("testComplexSnippet", i); } test("testComplexSnippet", 10); test("testComplexSnippet", 100); test("testComplexSnippet", 1000); --- 193,203 ---- return new int[]{x, y, z}; } @Test public void testComplex() { ! for (int i = -1; i < 10; i++) { test("testComplexSnippet", i); } test("testComplexSnippet", 10); test("testComplexSnippet", 100); test("testComplexSnippet", 1000);
*** 238,248 **** if (partialUnroll) { LoopsData dataCounted = new LoopsData(graph); dataCounted.detectedCountedLoops(); for (LoopEx loop : dataCounted.countedLoops()) { LoopFragmentInside newSegment = loop.inside().duplicate(); ! newSegment.insertWithinAfter(loop, false); } canonicalizer.apply(graph, getDefaultMidTierContext()); } new DeadCodeEliminationPhase().apply(graph); canonicalizer.apply(graph, context); --- 269,279 ---- if (partialUnroll) { LoopsData dataCounted = new LoopsData(graph); dataCounted.detectedCountedLoops(); for (LoopEx loop : dataCounted.countedLoops()) { LoopFragmentInside newSegment = loop.inside().duplicate(); ! newSegment.insertWithinAfter(loop, null); } canonicalizer.apply(graph, getDefaultMidTierContext()); } new DeadCodeEliminationPhase().apply(graph); canonicalizer.apply(graph, context);
< prev index next >