Skip to content

Commit

Permalink
Fix Split If issue with OpaqueAssertionPredicateNode
Browse files Browse the repository at this point in the history
  • Loading branch information
chhagedorn committed Sep 21, 2023
1 parent 770628d commit 9f13fdf
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/split_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@
* @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
*/

/*
* @test
* @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
*/

/*
Expand All @@ -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
*/

/*
Expand All @@ -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
*/

/*
Expand All @@ -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
*/

/*
Expand All @@ -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
*/

/*
Expand All @@ -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
*/

/*
Expand All @@ -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];
Expand Down Expand Up @@ -196,6 +196,7 @@ static void executeTests(String methods) {
test8308392No8();
runTest8308392No9();
test8308392No10();
testSplitIfCloneDownWithOpaqueAssertionPredicate();
}
case "Xbatch" -> {
for (int i = 0; i < 100000; i++) {
Expand Down Expand Up @@ -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() {
}

}

0 comments on commit 9f13fdf

Please sign in to comment.