# HG changeset patch # User Thomas Wuerthinger # Date 1426608940 -3600 # Node ID d66d53b6b73c882d84fb0af4722f9a0ac8b48fb2 # Parent c5c1c2de3cb8a4a20c3e141bcc4402f16bc2156b Add another memory schedule test. diff -r c5c1c2de3cb8 -r d66d53b6b73c graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Tue Mar 17 17:13:25 2015 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Tue Mar 17 17:15:40 2015 +0100 @@ -282,9 +282,42 @@ } /** + * Here the read should not float out of the loop. + */ + public static int testLoop7Snippet(int a, int b, MemoryScheduleTest obj) { + int ret = 0; + int bb = b; + for (int i = 0; i < a; i++) { + ret = obj.hash; + if (a > 10) { + bb++; + } else { + bb--; + for (int k = 0; k < a; ++k) { + if (k % 2 == 1) { + for (int j = 0; j < b; ++j) { + obj.hash = 3; + } + } + } + } + ret = ret / 10; + } + return ret + bb; + } + + @Test + public void testLoop7() { + SchedulePhase schedule = getFinalSchedule("testLoop7Snippet", TestMode.WITHOUT_FRAMESTATES); + assertDeepEquals(18, schedule.getCFG().getBlocks().size()); + assertReadWithinStartBlock(schedule, false); + assertReadWithinAllReturnBlocks(schedule, false); + } + + /** * Here the read should not float to the end. */ - public static int testLoop7Snippet(int a, int b) { + public static int testLoop8Snippet(int a, int b) { int result = container.a; for (int i = 0; i < a; i++) { if (b < 0) { @@ -301,8 +334,8 @@ } @Test - public void testLoop7() { - SchedulePhase schedule = getFinalSchedule("testLoop7Snippet", TestMode.WITHOUT_FRAMESTATES); + public void testLoop8() { + SchedulePhase schedule = getFinalSchedule("testLoop8Snippet", TestMode.WITHOUT_FRAMESTATES); assertDeepEquals(10, schedule.getCFG().getBlocks().size()); assertReadWithinStartBlock(schedule, true); assertReadWithinAllReturnBlocks(schedule, false);