1 /*
2  * Copyright (c) 2020, Red Hat, Inc. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 /**
25  * @test
26  * @bug 8240335
27  * @summary C2: assert(found_sfpt) failed: no node in loop that's not input to safepoint
28  *
29  * @run main/othervm -Xcomp -XX:CompileOnly=TestCastIIAfterUnrollingInOuterLoop TestCastIIAfterUnrollingInOuterLoop
30  *
31  */
32 
33 public class TestCastIIAfterUnrollingInOuterLoop {
34     public static final int N = 400;
35 
36     public static long instanceCount=727275458L;
37     public static int iFld=-10;
38     public static volatile short sFld=-2966;
39     public static float fFld=1.682F;
40     public static int iArrFld[]=new int[N];
41 
vMeth1(int i1)42     public static void vMeth1(int i1) {
43         int i3=4;
44         long lArr[]=new long[N], lArr1[]=new long[N];
45 
46         boolean b = (Integer.reverseBytes(i1 << 5) < (instanceCount++));
47         for (int i2 = 1; i2 < 146; i2++) {
48             iFld >>= (++i3);
49         }
50         if (b) {
51             for (int i4 = 4; i4 < 218; ++i4) {
52                 instanceCount = iArrFld[i4 - 1];
53                 int i10 = 1;
54                 while (++i10 < 8) {
55                     lArr1[i4] += 61384L;
56                 }
57                 lArr[i4 + 1] = i4;
58                 i3 += sFld;
59             }
60         }
61     }
62 
mainTest(String[] strArr1)63     public void mainTest(String[] strArr1) {
64         vMeth1(iFld);
65         for (int i19 = 2; i19 < 190; i19++) {
66             int i20 = (int)instanceCount;
67             instanceCount += (((i19 * i20) + i20) - fFld);
68         }
69     }
main(String[] strArr)70     public static void main(String[] strArr) {
71         TestCastIIAfterUnrollingInOuterLoop _instance = new TestCastIIAfterUnrollingInOuterLoop();
72         for (int i = 0; i < 10; i++) {
73             _instance.mainTest(strArr);
74         }
75     }
76 }
77