summaryrefslogtreecommitdiffstats
path: root/test/090-loop-formation
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-04-25 15:27:38 -0700
committerAndreas Gampe <agampe@google.com>2015-04-25 15:58:31 -0700
commitb15be57e51e63df5406d5c7c1c32784cc0ec4078 (patch)
treecf08f02ddf398b7486ecf5172de64562846fb10f /test/090-loop-formation
parent18772f087eb0eb14ba816ed088107c43958eb8c3 (diff)
downloadart-b15be57e51e63df5406d5c7c1c32784cc0ec4078.zip
art-b15be57e51e63df5406d5c7c1c32784cc0ec4078.tar.gz
art-b15be57e51e63df5406d5c7c1c32784cc0ec4078.tar.bz2
ART: Test for GVN skipping
Add a deeply nested loop to test 090 that will make the GVN skip. Change-Id: I7c160293e76fd858c550f792b357eaaccdde77a9
Diffstat (limited to 'test/090-loop-formation')
-rw-r--r--test/090-loop-formation/expected.txt1
-rw-r--r--test/090-loop-formation/src/Main.java26
2 files changed, 27 insertions, 0 deletions
diff --git a/test/090-loop-formation/expected.txt b/test/090-loop-formation/expected.txt
index b7e0bb3..b945c30 100644
--- a/test/090-loop-formation/expected.txt
+++ b/test/090-loop-formation/expected.txt
@@ -3,3 +3,4 @@ counter2 is 32767
counter3 is 32767
counter4 is 0
counter5 is 65534
+256
diff --git a/test/090-loop-formation/src/Main.java b/test/090-loop-formation/src/Main.java
index 7c16667..16ff3b2 100644
--- a/test/090-loop-formation/src/Main.java
+++ b/test/090-loop-formation/src/Main.java
@@ -52,5 +52,31 @@ public class Main {
System.out.println("counter3 is " + counter3);
System.out.println("counter4 is " + counter4);
System.out.println("counter5 is " + counter5);
+
+ deeplyNested();
+ }
+
+ // GVN is limited to a maximum loop depth of 6. To track whether dependent passes are
+ // correctly turned off, test some very simple, but deeply nested loops.
+ private static void deeplyNested() {
+ int sum = 0;
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 2; j++) {
+ for (int k = 0; k < 2; k++) {
+ for (int l = 0; l < 2; l++) {
+ for (int m = 0; m < 2; m++) {
+ for (int n = 0; n < 2; n++) {
+ for (int o = 0; o < 2; o++) {
+ for (int p = 0; p < 2; p++) {
+ sum++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ System.out.println(sum);
}
}