From 527628ebb9472081da4a06688e3148367c23bda4 Mon Sep 17 00:00:00 2001 From: Rahul Raghavan Date: Wed, 2 Dec 2020 19:47:25 +0530 Subject: [PATCH 1/3] 8238812: assert(false) failed: bad AD file --- src/hotspot/share/opto/phaseX.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/hotspot/share/opto/phaseX.cpp b/src/hotspot/share/opto/phaseX.cpp index b952b649ff4f3..d01b1a41d9de5 100644 --- a/src/hotspot/share/opto/phaseX.cpp +++ b/src/hotspot/share/opto/phaseX.cpp @@ -1552,6 +1552,18 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) { } } if (use_op == Op_CmpI) { + // Put If on worklist to enable fold_compares optimization (see IfNode::cmpi_folds) + if (use->outcnt() > 0) { + for (uint i = 0; i < use->outcnt(); i++) { + Node* bol = use->raw_out(i); + if (bol->outcnt() > 0) { + Node* iff = bol->raw_out(0); + if (iff->Opcode() == Op_If && iff->outcnt() == 2) { + add_users_to_worklist0(bol); + } + } + } + } Node* phi = countedloop_phi_from_cmp((CmpINode*)use, n); if (phi != NULL) { // If an opaque node feeds into the limit condition of a From f3e3ecaa0a5b736b97d3ca6d617c630057f49e08 Mon Sep 17 00:00:00 2001 From: Rahul Raghavan Date: Thu, 3 Dec 2020 12:06:08 +0530 Subject: [PATCH 2/3] 8238812: assert(false) failed: bad AD file --- .../jtreg/compiler/c2/Test8238812.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/c2/Test8238812.java diff --git a/test/hotspot/jtreg/compiler/c2/Test8238812.java b/test/hotspot/jtreg/compiler/c2/Test8238812.java new file mode 100644 index 0000000000000..a39f51bb7a5a5 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/Test8238812.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8238812 + * @summary Fix c2 assert(false) failed: bad AD file + * @run main/othervm -XX:CompileCommand=compileonly,compiler.c2.Test8238812::test + * -XX:CompileCommand=dontinline,compiler.c2.Test8238812::test + * -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+UseSwitchProfiling + * compiler.c2.Test8238812 + */ + +package compiler.c2; + +public class Test8238812 { + + public static void test() { + int i4, i5=99, i6, i9=89; + for (i4 = 12; i4 < 365; i4++) { + for (i6 = 5; i6 > 1; i6--) { + switch ((i6 * 5) + 11) { + case 13: + case 19: + case 26: + case 31: + case 35: + case 41: + case 43: + case 61: + case 71: + case 83: + case 314: + i9 = i5; + break; + } + } + } + } + + public static void main(String[] strArr) { + for (int i = 0; i < 10; i++) { + test(); + } + } + +} From 98eccfa4a4e104cd3feaf4c41d0cea1866f26bd4 Mon Sep 17 00:00:00 2001 From: Rahul Raghavan Date: Thu, 3 Dec 2020 12:15:56 +0530 Subject: [PATCH 3/3] 8238812: assert(false) failed: bad AD file --- test/hotspot/jtreg/compiler/c2/Test8238812.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/compiler/c2/Test8238812.java b/test/hotspot/jtreg/compiler/c2/Test8238812.java index a39f51bb7a5a5..8a3ff99c4ce5c 100644 --- a/test/hotspot/jtreg/compiler/c2/Test8238812.java +++ b/test/hotspot/jtreg/compiler/c2/Test8238812.java @@ -25,7 +25,7 @@ * @test * @bug 8238812 * @summary Fix c2 assert(false) failed: bad AD file - * @run main/othervm -XX:CompileCommand=compileonly,compiler.c2.Test8238812::test + * @run main/othervm -XX:CompileCommand=compileonly,compiler.c2.Test8238812::test * -XX:CompileCommand=dontinline,compiler.c2.Test8238812::test * -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -XX:+UseSwitchProfiling * compiler.c2.Test8238812