Path: blob/master/test/hotspot/jtreg/compiler/loopopts/TestBrokenAntiDependenceWithPhi.java
41149 views
/*1* Copyright (c) 2021, Red Hat, Inc. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 825964126* @summary C2: assert(early->dominates(LCA)) failed: early is high enough27*28* @run main/othervm -Xcomp -XX:CompileOnly=TestBrokenAntiDependenceWithPhi TestBrokenAntiDependenceWithPhi29*30*/3132public class TestBrokenAntiDependenceWithPhi {3334int a;35int b;36byte c;3738long e(int f, int g, long h) {39int i[] = new int[a];40double j = 2.74886;41long k[][] = new long[a][a];42long l = checkSum(k);43return l;44}4546void m() {47int s, o, p[] = new int[a];48double d;49for (d = 5; d < 388; d++) {50e(b, b, 40418347472393L);51for (s = 3; s < 66; ++s)52int1array(a, 9);53}54for (o = 6; o > 2; o--)55p[o] = c;56}5758public static void main(String[] q) {59TestBrokenAntiDependenceWithPhi r = new TestBrokenAntiDependenceWithPhi();60try {61r.m();62} catch (ArrayIndexOutOfBoundsException aioobe) {63}64}6566public static long checkSum(long[] a) {67long sum = 0;68for (int j = 0; j < a.length; j++) {69sum += (a[j] / (j + 1) + a[j] % (j + 1));70}71return sum;72}7374public static long checkSum(long[][] a) {75long sum = 0;76for (int j = 0; j < a.length; j++) {77sum += checkSum(a[j]);78}79return sum;80}8182public static int[] int1array(int sz, int seed) {83int[] ret = new int[sz];84init(ret, seed);85return ret;86}8788public static void init(int[] a, int seed) {89for (int j = 0; j < a.length; j++) {90a[j] = (j % 2 == 0) ? seed + j : seed - j;91}92}9394}959697