@@ -1189,8 +1189,10 @@ bool IdealLoopTree::policy_range_check(PhaseIdealLoop* phase, bool provisional,
11891189 continue ;
11901190 }
11911191 if (!bol->is_Bool ()) {
1192- assert (bol->is_Opaque4 () || bol->is_OpaqueInitializedAssertionPredicate (),
1193- " Opaque node of non-null-check or of Initialized Assertion Predicate" );
1192+ assert (bol->is_OpaqueNotNull () ||
1193+ bol->is_OpaqueTemplateAssertionPredicate () ||
1194+ bol->is_OpaqueInitializedAssertionPredicate (),
1195+ " Opaque node of a non-null-check or an Assertion Predicate" );
11941196 continue ;
11951197 }
11961198 if (bol->as_Bool ()->_test ._test == BoolTest::ne) {
@@ -1359,7 +1361,7 @@ void PhaseIdealLoop::copy_assertion_predicates_to_main_loop_helper(const Predica
13591361 break ;
13601362 Node* bol = iff->in (1 );
13611363 assert (!bol->is_OpaqueInitializedAssertionPredicate (), " should not find an Initialized Assertion Predicate" );
1362- if (bol->is_Opaque4 ()) {
1364+ if (bol->is_OpaqueTemplateAssertionPredicate ()) {
13631365 // Clone the Assertion Predicate twice and initialize one with the initial
13641366 // value of the loop induction variable. Leave the other predicate
13651367 // to be initialized when increasing the stride during loop unrolling.
@@ -1399,11 +1401,11 @@ void PhaseIdealLoop::copy_assertion_predicates_to_main_loop_helper(const Predica
13991401 }
14001402}
14011403
1404+ #ifdef ASSERT
14021405bool PhaseIdealLoop::assertion_predicate_has_loop_opaque_node (IfNode* iff) {
14031406 uint init;
14041407 uint stride;
14051408 count_opaque_loop_nodes (iff->in (1 )->in (1 ), init, stride);
1406- #ifdef ASSERT
14071409 ResourceMark rm;
14081410 Unique_Node_List wq;
14091411 wq.clear ();
@@ -1429,10 +1431,10 @@ bool PhaseIdealLoop::assertion_predicate_has_loop_opaque_node(IfNode* iff) {
14291431 }
14301432 }
14311433 assert (init == verif_init && stride == verif_stride, " missed opaque node" );
1432- #endif
14331434 assert (stride == 0 || init != 0 , " init should be there every time stride is" );
14341435 return init != 0 ;
14351436}
1437+ #endif // ASSERT
14361438
14371439void PhaseIdealLoop::count_opaque_loop_nodes (Node* n, uint& init, uint& stride) {
14381440 init = 0 ;
@@ -1475,14 +1477,15 @@ IfTrueNode* PhaseIdealLoop::create_initialized_assertion_predicate(IfNode* templ
14751477
14761478// Clone the Template Assertion Predicate and set a new OpaqueLoopInitNode to create a new Template Assertion Predicate.
14771479// This is done when creating a new Template Assertion Predicate for the main loop which requires a new init node.
1478- // We keep the Opaque4 node since it's still a template. Since the templates are eventually removed after loop opts,
1479- // these are never executed. We therefore insert a Halt node instead of an uncommon trap.
1480+ // We keep the OpaqueTemplateAssertionPredicate node since it's still a template. Since the templates are eventually
1481+ // removed after loop opts, these are never executed. We therefore insert a Halt node instead of an uncommon trap.
14801482Node* PhaseIdealLoop::clone_template_assertion_predicate (IfNode* iff, Node* new_init, Node* predicate, Node* uncommon_proj,
14811483 Node* control, IdealLoopTree* outer_loop, Node* new_control) {
14821484 assert (assertion_predicate_has_loop_opaque_node (iff), " must find OpaqueLoop* nodes for Template Assertion Predicate" );
1483- TemplateAssertionExpression template_assertion_expression (iff->in (1 )->as_Opaque4 ());
1485+ TemplateAssertionExpression template_assertion_expression (iff->in (1 )->as_OpaqueTemplateAssertionPredicate ());
14841486 assert (new_init->is_OpaqueLoopInit (), " only for creating new Template Assertion Predicates" );
1485- Opaque4Node* new_opaque_node = template_assertion_expression.clone_and_replace_init (new_init, control, this );
1487+ OpaqueTemplateAssertionPredicateNode* new_opaque_node =
1488+ template_assertion_expression.clone_and_replace_init (new_init, control, this );
14861489 AssertionPredicateIfCreator assertion_predicate_if_creator (this );
14871490 IfTrueNode* success_proj =
14881491 assertion_predicate_if_creator.create_for_template (new_control, iff->Opcode (), new_opaque_node
@@ -1922,25 +1925,21 @@ void PhaseIdealLoop::update_main_loop_assertion_predicates(Node* ctrl, CountedLo
19221925 break ;
19231926 }
19241927 Node* bol = iff->in (1 );
1925- if (bol->is_Opaque4 ()) {
1926- if (assertion_predicate_has_loop_opaque_node (iff)) {
1927- // This is a Template Assertion Predicate for the initial or last access.
1928- // Create an Initialized Assertion Predicates for it accordingly:
1929- // - For the initial access a[init] (same as before)
1930- // - For the last access a[init+new_stride-orig_stride] (with the new unroll stride)
1931- prev_proj = create_initialized_assertion_predicate (iff, init, max_value, prev_proj);
1932- } else {
1933- // Ignore Opaque4 from a non-null-check for an intrinsic or unsafe access. This could happen when we maximally
1934- // unroll a non-main loop with such an If with an Opaque4 node directly above the loop entry.
1935- assert (!loop_head->is_main_loop (), " Opaque4 node from a non-null check - should not be at main loop" );
1936- }
1928+ if (bol->is_OpaqueTemplateAssertionPredicate ()) {
1929+ assert (assertion_predicate_has_loop_opaque_node (iff), " must find OpaqueLoop* nodes" );
1930+ // This is a Template Assertion Predicate for the initial or last access.
1931+ // Create an Initialized Assertion Predicates for it accordingly:
1932+ // - For the initial access a[init] (same as before)
1933+ // - For the last access a[init+new_stride-orig_stride] (with the new unroll stride)
1934+ prev_proj = create_initialized_assertion_predicate (iff, init, max_value, prev_proj);
19371935 } else if (bol->is_OpaqueInitializedAssertionPredicate ()) {
19381936 // This is one of the two Initialized Assertion Predicates:
19391937 // - For the initial access a[init]
19401938 // - For the last access a[init+old_stride-orig_stride]
19411939 // We could keep the one for the initial access but we do not know which one we currently have here. Just kill both.
19421940 _igvn.replace_input_of (iff, 1 , _igvn.intcon (1 ));
19431941 }
1942+ assert (!bol->is_OpaqueNotNull () || !loop_head->is_main_loop (), " OpaqueNotNull should not be at main loop" );
19441943 entry = entry->in (0 )->in (0 );
19451944 }
19461945 if (prev_proj != ctrl) {
@@ -1967,7 +1966,7 @@ void PhaseIdealLoop::copy_assertion_predicates_to_post_loop(LoopNode* main_loop_
19671966 if (!proj->unique_ctrl_out ()->is_Halt ()) {
19681967 break ;
19691968 }
1970- if (iff->in (1 )->is_Opaque4 ()) {
1969+ if (iff->in (1 )->is_OpaqueTemplateAssertionPredicate ()) {
19711970 // Initialize from Template Assertion Predicate.
19721971 prev_proj = create_initialized_assertion_predicate (iff, init, stride, prev_proj);
19731972 }
@@ -2000,7 +1999,7 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_peeled_loop(const Predi
20001999 }
20012000 Node* bol = iff->in (1 );
20022001 assert (!bol->is_OpaqueInitializedAssertionPredicate (), " should not find an Initialized Assertion Predicate" );
2003- if (bol->is_Opaque4 ()) {
2002+ if (bol->is_OpaqueTemplateAssertionPredicate ()) {
20042003 // Initialize from Template Assertion Predicate.
20052004 input_proj = create_initialized_assertion_predicate (iff, init, stride, input_proj);
20062005
0 commit comments