diff --git a/src/hotspot/share/opto/split_if.cpp b/src/hotspot/share/opto/split_if.cpp index 6fa7ff1e2b199..51b4ed8085d76 100644 --- a/src/hotspot/share/opto/split_if.cpp +++ b/src/hotspot/share/opto/split_if.cpp @@ -322,7 +322,7 @@ bool PhaseIdealLoop::clone_cmp_down(Node* n, const Node* blk1, const Node* blk2) assert( bol->is_Bool(), "" ); if (bol->outcnt() == 1) { Node* use = bol->unique_out(); - if (use->Opcode() == Op_Opaque4) { + if (use->Opcode() == Op_Opaque4 || (UseNewCode && use->Opcode() == Op_OpaqueAssertionPredicate)) { if (use->outcnt() == 1) { Node* iff = use->unique_out(); assert(iff->is_If(), "unexpected node type"); @@ -366,7 +366,7 @@ bool PhaseIdealLoop::clone_cmp_down(Node* n, const Node* blk1, const Node* blk2) register_new_node(cloned_bool, template_assertion_predicate); _igvn.replace_input_of(template_assertion_predicate, template_bool_input, cloned_bool); --j; - } else if (u->Opcode() == Op_Opaque4) { + } else if (u->Opcode() == Op_Opaque4 || u->Opcode() == Op_OpaqueAssertionPredicate) { assert(u->in(1) == bol, "bad input"); for (DUIterator_Last kmin, k = u->last_outs(kmin); k >= kmin; --k) { Node* iff = u->last_out(k); diff --git a/test/hotspot/jtreg/compiler/predicates/assertion/TestAssertionPredicates.java b/test/hotspot/jtreg/compiler/predicates/TestAssertionPredicates.java similarity index 95% rename from test/hotspot/jtreg/compiler/predicates/assertion/TestAssertionPredicates.java rename to test/hotspot/jtreg/compiler/predicates/TestAssertionPredicates.java index bbd6a0ed07f47..bd449b2890b0f 100644 --- a/test/hotspot/jtreg/compiler/predicates/assertion/TestAssertionPredicates.java +++ b/test/hotspot/jtreg/compiler/predicates/TestAssertionPredicates.java @@ -27,9 +27,9 @@ * @bug 8288981 * @summary TODO * @run main/othervm -Xbatch - * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=dontinline,compiler.predicates.assertion.TestAssertionPredicates::* - * compiler.predicates.assertion.TestAssertionPredicates Xbatch + * -XX:CompileCommand=compileonly,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=dontinline,compiler.predicates.TestAssertionPredicates::* + * compiler.predicates.TestAssertionPredicates Xbatch */ /* @@ -37,10 +37,10 @@ * @bug 8288981 * @summary TODO * @run main/othervm -Xcomp - * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=dontinline,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=inline,compiler.predicates.assertion.TestAssertionPredicates::inline - * compiler.predicates.assertion.TestAssertionPredicates Xcomp + * -XX:CompileCommand=compileonly,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=dontinline,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=inline,compiler.predicates.TestAssertionPredicates::inline + * compiler.predicates.TestAssertionPredicates Xcomp */ /* @@ -49,9 +49,9 @@ * @summary TODO * @requires vm.compiler2.enabled * @run main/othervm -Xcomp -XX:-UseProfiledLoopPredicate - * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=dontinline,compiler.predicates.assertion.TestAssertionPredicates::* - * compiler.predicates.assertion.TestAssertionPredicates NoProfiledLoopPredicate + * -XX:CompileCommand=compileonly,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=dontinline,compiler.predicates.TestAssertionPredicates::* + * compiler.predicates.TestAssertionPredicates NoProfiledLoopPredicate */ /* @@ -60,9 +60,9 @@ * @summary TODO * @requires vm.compiler2.enabled * @run main/othervm -Xcomp -XX:LoopMaxUnroll=0 - * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=dontinline,compiler.predicates.assertion.TestAssertionPredicates::* - * compiler.predicates.assertion.TestAssertionPredicates LoopMaxUnroll0 + * -XX:CompileCommand=compileonly,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=dontinline,compiler.predicates.TestAssertionPredicates::* + * compiler.predicates.TestAssertionPredicates LoopMaxUnroll0 */ /* @@ -71,9 +71,9 @@ * @summary TODO * @requires vm.compiler2.enabled * @run main/othervm -Xcomp -XX:LoopMaxUnroll=2 - * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=dontinline,compiler.predicates.assertion.TestAssertionPredicates::* - * compiler.predicates.assertion.TestAssertionPredicates LoopMaxUnroll2 + * -XX:CompileCommand=compileonly,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=dontinline,compiler.predicates.TestAssertionPredicates::* + * compiler.predicates.TestAssertionPredicates LoopMaxUnroll2 */ /* @@ -82,9 +82,9 @@ * @summary TODO * @requires vm.compiler2.enabled * @run main/othervm -Xcomp -XX:LoopUnrollLimit=40 - * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=dontinline,compiler.predicates.assertion.TestAssertionPredicates::* - * compiler.predicates.assertion.TestAssertionPredicates LoopUnrollLimit40 + * -XX:CompileCommand=compileonly,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=dontinline,compiler.predicates.TestAssertionPredicates::* + * compiler.predicates.TestAssertionPredicates LoopUnrollLimit40 */ /* @@ -93,9 +93,9 @@ * @summary TODO * @requires vm.compiler2.enabled * @run main/othervm -Xcomp -XX:LoopUnrollLimit=150 - * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=dontinline,compiler.predicates.assertion.TestAssertionPredicates::* - * compiler.predicates.assertion.TestAssertionPredicates LoopUnrollLimit150 + * -XX:CompileCommand=compileonly,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=dontinline,compiler.predicates.TestAssertionPredicates::* + * compiler.predicates.TestAssertionPredicates LoopUnrollLimit150 */ /* @@ -106,13 +106,13 @@ * @requires vm.gc.ZSinglegen * @requires vm.compiler2.enabled * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:+UseZGC -XX:-ZGenerational - * -XX:CompileCommand=compileonly,compiler.predicates.assertion.TestAssertionPredicates::* - * -XX:CompileCommand=dontinline,compiler.predicates.assertion.TestAssertionPredicates::* - * compiler.predicates.assertion.TestAssertionPredicates ZGCStressGCM + * -XX:CompileCommand=compileonly,compiler.predicates.TestAssertionPredicates::* + * -XX:CompileCommand=dontinline,compiler.predicates.TestAssertionPredicates::* + * compiler.predicates.TestAssertionPredicates ZGCStressGCM */ -package compiler.predicates.assertion; +package compiler.predicates; public class TestAssertionPredicates { static int[] iArr = new int[100]; @@ -196,6 +196,7 @@ static void executeTests(String methods) { test8308392No8(); runTest8308392No9(); test8308392No10(); + testSplitIfCloneDownWithOpaqueAssertionPredicate(); } case "Xbatch" -> { for (int i = 0; i < 100000; i++) { @@ -1131,4 +1132,27 @@ static void test8308392No10() { for (i21 = 1; i21 < 2; i21++) {} } } + + static void testSplitIfCloneDownWithOpaqueAssertionPredicate() { + int p = 0, j; + if (flag) { + iArr[3] = 3; + dontInline(); + } + int i = 1; + while (++i < 4) { + if (flag) { + p = 8; + } + iArr[i - 1] = 4; + for (j = 1; j < 3; ++j) { + iArr[j] = 34; + } + } + long n = p; + } + + static void dontInline() { + } + }