equal
deleted
inserted
replaced
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 8159016 8202949 |
26 * @bug 8159016 8202949 8203915 |
27 * @summary Tests correct dominator information after over-unrolling a loop. |
27 * @summary Tests correct dominator information after over-unrolling a loop. |
28 * @requires vm.gc == "Parallel" | vm.gc == "null" |
28 * @requires vm.gc == "Parallel" | vm.gc == "null" |
29 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions |
29 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions |
30 * -Xcomp -XX:-TieredCompilation -XX:-UseSwitchProfiling |
30 * -Xcomp -XX:-TieredCompilation -XX:-UseSwitchProfiling |
|
31 * -XX:-UseCountedLoopSafepoints -XX:LoopUnrollLimit=250 |
31 * -XX:-UseG1GC -XX:+UseParallelGC compiler.loopopts.TestOverunrolling |
32 * -XX:-UseG1GC -XX:+UseParallelGC compiler.loopopts.TestOverunrolling |
32 */ |
33 */ |
33 |
34 |
34 package compiler.loopopts; |
35 package compiler.loopopts; |
35 |
36 |
79 } while (++k < 1); |
80 } while (++k < 1); |
80 } |
81 } |
81 } |
82 } |
82 } |
83 } |
83 |
84 |
|
85 // Similar to test2 but we cannot statically determine the upper bound of |
|
86 // the inner for loop and can therefore not prevent over-unrolling. |
|
87 public static void test3(int[] array) { |
|
88 int[] iArr = new int[8]; |
|
89 for (int i = 0; i < array.length; i++) { |
|
90 for (int j = 5; j < i; j++) { |
|
91 int k = 1; |
|
92 do { |
|
93 iArr[j] = 0; |
|
94 switch (k) { |
|
95 case 1: |
|
96 lFld = 0; |
|
97 break; |
|
98 case 10: |
|
99 dFld = 0; |
|
100 break; |
|
101 } |
|
102 } while (++k < 1); |
|
103 } |
|
104 } |
|
105 } |
|
106 |
|
107 // Similar to test3 but with negative stride and constant outer loop limit |
|
108 public static void test4(int[] array, boolean store) { |
|
109 int[] iArr = new int[8]; |
|
110 for (int i = -8; i < 8; i++) { |
|
111 for (int j = 5; j > i; j--) { |
|
112 int k = 1; |
|
113 do { |
|
114 if (store) { |
|
115 iArr[j] = 0; |
|
116 } |
|
117 switch (k) { |
|
118 case 1: |
|
119 lFld = 0; |
|
120 break; |
|
121 case 10: |
|
122 dFld = 0; |
|
123 break; |
|
124 } |
|
125 } while (++k < 1); |
|
126 } |
|
127 } |
|
128 } |
|
129 |
|
130 // The inner for-loop is over-unrolled and vectorized resulting in |
|
131 // a crash in the matcher because the memory input to a vector is top. |
|
132 public static int test5(int[] array) { |
|
133 int result = 0; |
|
134 int[] iArr = new int[8]; |
|
135 for (int i = 0; i < array.length; i++) { |
|
136 for (int j = 5; j < i; j++) { |
|
137 iArr[j] += array[j]; |
|
138 result += array[j]; |
|
139 } |
|
140 } |
|
141 return result; |
|
142 } |
|
143 |
84 public static void main(String args[]) { |
144 public static void main(String args[]) { |
85 for (int i = 0; i < 42; ++i) { |
145 for (int i = 0; i < 42; ++i) { |
86 test1(i); |
146 test1(i); |
87 } |
147 } |
88 test2(); |
148 test2(); |
|
149 int[] array = new int[8]; |
|
150 test3(array); |
|
151 test4(array, false); |
|
152 test5(array); |
89 } |
153 } |
90 } |
154 } |
91 |
155 |