UnrollLoopAction: support counting loop; limit max iterations to unroll

This commit is contained in:
Tagir Valeev
2017-10-09 11:24:05 +07:00
parent 8e19d90cd7
commit cdd80f8de4
6 changed files with 167 additions and 40 deletions
@@ -0,0 +1,15 @@
// "Unroll loop" "true"
class Test {
void test() {
System.out.println("Hi!" + 0);
System.out.println("Hi!" + 1);
System.out.println("Hi!" + 2);
System.out.println("Hi!" + 3);
System.out.println("Hi!" + 4);
System.out.println("Hi!" + 5);
System.out.println("Hi!" + 6);
System.out.println("Hi!" + 7);
System.out.println("Hi!" + 8);
System.out.println("Hi!" + 9);
}
}
@@ -0,0 +1,38 @@
// "Unroll loop" "true"
class Test {
void test() {
if (0L % 7 != 6) {
System.out.println("Hi!" + 0L);
if (1L % 7 != 6) {
System.out.println("Hi!" + 1L);
if (2L % 7 != 6) {
System.out.println("Hi!" + 2L);
if (3L % 7 != 6) {
System.out.println("Hi!" + 3L);
if (4L % 7 != 6) {
System.out.println("Hi!" + 4L);
if (5L % 7 != 6) {
System.out.println("Hi!" + 5L);
if (6L % 7 != 6) {
System.out.println("Hi!" + 6L);
if (7L % 7 != 6) {
System.out.println("Hi!" + 7L);
if (8L % 7 != 6) {
System.out.println("Hi!" + 8L);
if (9L % 7 != 6) {
System.out.println("Hi!" + 9L);
if (10L % 7 != 6) {
System.out.println("Hi!" + 10L);
}
}
}
}
}
}
}
}
}
}
}
}
}
@@ -0,0 +1,8 @@
// "Unroll loop" "true"
class Test {
void test() {
fo<caret>r (int i = 0; i < 10; i++) {
System.out.println("Hi!" + i);
}
}
}
@@ -0,0 +1,8 @@
// "Unroll loop" "false"
class Test {
void test() {
fo<caret>r (int i = 0; i < 1000; i++) {
System.out.println("Hi!" + i);
}
}
}
@@ -0,0 +1,9 @@
// "Unroll loop" "true"
class Test {
void test() {
fo<caret>r (long i = 0; i <= 10; i++) {
if (i % 7 == 6) break;
System.out.println("Hi!" + i);
}
}
}