2323
2424/*
2525 * @test
26- * @bug 8284358
26+ * @bug 8284358 8296912
2727 * @summary An unreachable loop is not removed, leading to a broken graph.
2828 * @requires vm.compiler2.enabled
2929 * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=1448005075
30- * -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
30+ * -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
3131 * compiler.c2.TestDeadDataLoop
3232 * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=1922737097
33- * -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
33+ * -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
34+ * compiler.c2.TestDeadDataLoop
35+ * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN -XX:StressSeed=2472844645
36+ * -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
3437 * compiler.c2.TestDeadDataLoop
3538 * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+StressIGVN
36- * -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined
39+ * -XX:CompileCommand=compileonly,*TestDeadDataLoop::test* -XX:CompileCommand=dontinline,*TestDeadDataLoop::notInlined*
3740 * compiler.c2.TestDeadDataLoop
3841 */
3942
@@ -216,10 +219,29 @@ static void test10() {
216219 }
217220 }
218221
222+ static long l ;
223+
224+ static void test11 (boolean never ) {
225+ float f = 1 ;
226+ boolean b ;
227+ for (int i = 0 ; i < 5 ; ++i ) {
228+ b = (never || l < 0 );
229+ l = notInlined2 ();
230+ if (!never ) {
231+ f += i ;
232+ }
233+ }
234+ l += f ;
235+ }
236+
219237 public static boolean notInlined () {
220238 return false ;
221239 }
222240
241+ public static int notInlined2 () {
242+ return 42 ;
243+ }
244+
223245 public static void main (String [] args ) {
224246 // Make sure classes are initialized
225247 Integer i = 42 ;
@@ -234,6 +256,7 @@ public static void main(String[] args) {
234256 test8 ();
235257 test9 ();
236258 test10 ();
259+ test11 (false );
237260 }
238261}
239262
0 commit comments