test/hotspot/jtreg/compiler/loopstripmining/DeadNodesInOuterLoopAtLoopCloning.java
author roland
Wed, 28 Aug 2019 15:51:03 +0200
changeset 58285 1182ff8929cc
permissions -rw-r--r--
8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node Reviewed-by: thartmann, neliasso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58285
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     1
/*
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     4
 *
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     8
 *
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    13
 * accompanied this code).
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    14
 *
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    18
 *
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    21
 * questions.
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    22
 */
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    23
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    24
/**
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    25
 * @test
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    26
 * @bug 8230061
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    27
 * @summary loop unrolling breaks when outer strip mined loop contains dead node
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    28
 *
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    29
 * @run main/othervm -Xmx1G DeadNodesInOuterLoopAtLoopCloning
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    30
 *
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    31
 */
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    32
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    33
public class DeadNodesInOuterLoopAtLoopCloning {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    34
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    35
    public static final int N = 400;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    36
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    37
    public static long instanceCount=-2288355609708559532L;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    38
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    39
    public static double checkSum(double[] a) {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    40
        double sum = 0;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    41
        for (int j = 0; j < a.length; j++) {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    42
            sum += (a[j] / (j + 1) + a[j] % (j + 1));
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    43
        }
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    44
        return sum;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    45
    }
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    46
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    47
    public static int iMeth(double d1) {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    48
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    49
        int i4=6022, i5=-211, i6=-15841, iArr[]=new int[N];
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    50
        double d2=-8.78129, dArr[]=new double[N];
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    51
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    52
        i5 = 1;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    53
        do {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    54
            i6 = 1;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    55
            while (++i6 < 5) {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    56
                i4 = -933;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    57
                i4 *= i4;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    58
                dArr[i5 + 1] = i4;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    59
                i4 -= i4;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    60
                d2 = 1;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    61
                do {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    62
                    iArr[(int)(d2 + 1)] += (int)instanceCount;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    63
                    try {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    64
                        i4 = (i4 % -51430);
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    65
                        i4 = (iArr[i6] % 31311);
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    66
                        iArr[i6 + 1] = (24197 / i5);
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    67
                    } catch (ArithmeticException a_e) {}
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    68
                    i4 -= (int)instanceCount;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    69
                    i4 <<= i5;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    70
                    i4 &= 12;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    71
                } while (++d2 < 1);
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    72
            }
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    73
        } while (++i5 < 320);
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    74
        long meth_res = Double.doubleToLongBits(checkSum(dArr));
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    75
        return (int)meth_res;
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    76
    }
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    77
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    78
    public static void main(String[] strArr) {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    79
        DeadNodesInOuterLoopAtLoopCloning _instance = new DeadNodesInOuterLoopAtLoopCloning();
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    80
        for (int i = 0; i < 10 * 320; i++ ) {
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    81
            _instance.iMeth(0.8522);
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    82
        }
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    83
    }
1182ff8929cc 8230061: # assert(mode == ControlAroundStripMined && use == sfpt) failed: missed a node
roland
parents:
diff changeset
    84
}