test/hotspot/jtreg/compiler/loopstripmining/DeadNodesInOuterLoopAtLoopCloning.java
changeset 58285 1182ff8929cc
equal deleted inserted replaced
58284:59f7c242ccb8 58285:1182ff8929cc
       
     1 /*
       
     2  * Copyright (c) 2019, 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 8230061
       
    27  * @summary loop unrolling breaks when outer strip mined loop contains dead node
       
    28  *
       
    29  * @run main/othervm -Xmx1G DeadNodesInOuterLoopAtLoopCloning
       
    30  *
       
    31  */
       
    32 
       
    33 public class DeadNodesInOuterLoopAtLoopCloning {
       
    34 
       
    35     public static final int N = 400;
       
    36 
       
    37     public static long instanceCount=-2288355609708559532L;
       
    38 
       
    39     public static double checkSum(double[] a) {
       
    40         double sum = 0;
       
    41         for (int j = 0; j < a.length; j++) {
       
    42             sum += (a[j] / (j + 1) + a[j] % (j + 1));
       
    43         }
       
    44         return sum;
       
    45     }
       
    46 
       
    47     public static int iMeth(double d1) {
       
    48 
       
    49         int i4=6022, i5=-211, i6=-15841, iArr[]=new int[N];
       
    50         double d2=-8.78129, dArr[]=new double[N];
       
    51 
       
    52         i5 = 1;
       
    53         do {
       
    54             i6 = 1;
       
    55             while (++i6 < 5) {
       
    56                 i4 = -933;
       
    57                 i4 *= i4;
       
    58                 dArr[i5 + 1] = i4;
       
    59                 i4 -= i4;
       
    60                 d2 = 1;
       
    61                 do {
       
    62                     iArr[(int)(d2 + 1)] += (int)instanceCount;
       
    63                     try {
       
    64                         i4 = (i4 % -51430);
       
    65                         i4 = (iArr[i6] % 31311);
       
    66                         iArr[i6 + 1] = (24197 / i5);
       
    67                     } catch (ArithmeticException a_e) {}
       
    68                     i4 -= (int)instanceCount;
       
    69                     i4 <<= i5;
       
    70                     i4 &= 12;
       
    71                 } while (++d2 < 1);
       
    72             }
       
    73         } while (++i5 < 320);
       
    74         long meth_res = Double.doubleToLongBits(checkSum(dArr));
       
    75         return (int)meth_res;
       
    76     }
       
    77 
       
    78     public static void main(String[] strArr) {
       
    79         DeadNodesInOuterLoopAtLoopCloning _instance = new DeadNodesInOuterLoopAtLoopCloning();
       
    80         for (int i = 0; i < 10 * 320; i++ ) {
       
    81             _instance.iMeth(0.8522);
       
    82         }
       
    83     }
       
    84 }