|
| 1 | +/* |
| 2 | + * Copyright (c) 2021, Oracle and/or its affiliates. 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 | + * @key stress randomness |
| 27 | + * @requires vm.compiler2.enabled |
| 28 | + * @bug 8268019 |
| 29 | + * @summary Splitting an If through a dying loop header region that is not a LoopNode, yet, results in a dead data loop. |
| 30 | + * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,compiler.c2.TestDeadLoopSplitIfLoop::test -XX:+UnlockDiagnosticVMOptions |
| 31 | + * -XX:+StressIGVN -XX:StressSeed=2382674767 -XX:CompileCommand=dontinline,compiler.c2.TestDeadLoopSplitIfLoop::test |
| 32 | + * compiler.c2.TestDeadLoopSplitIfLoop |
| 33 | + * @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,compiler.c2.TestDeadLoopSplitIfLoop::test -XX:+UnlockDiagnosticVMOptions |
| 34 | + * -XX:+StressIGVN -XX:CompileCommand=dontinline,compiler.c2.TestDeadLoopSplitIfLoop::test |
| 35 | + * compiler.c2.TestDeadLoopSplitIfLoop |
| 36 | + */ |
| 37 | +package compiler.c2; |
| 38 | + |
| 39 | +public class TestDeadLoopSplitIfLoop { |
| 40 | + int a; |
| 41 | + int b; |
| 42 | + boolean c; |
| 43 | + |
| 44 | + public static void main(String[] g) { |
| 45 | + TestDeadLoopSplitIfLoop h = new TestDeadLoopSplitIfLoop(); |
| 46 | + h.test(); |
| 47 | + } |
| 48 | + |
| 49 | + void test() { |
| 50 | + int e = 4; |
| 51 | + long f[] = new long[a]; |
| 52 | + if (c) { |
| 53 | + } else if (c) { |
| 54 | + // Dead path is removed after parsing which results in a dead data loop for certain node orderings in IGVN. |
| 55 | + switch (126) { |
| 56 | + case 126: |
| 57 | + do { |
| 58 | + f[e] = b; |
| 59 | + switch (6) { |
| 60 | + case 7: |
| 61 | + f = f; |
| 62 | + } |
| 63 | + } while (e++ < 93); |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | +} |
0 commit comments