@@ -1309,19 +1309,6 @@ Node *PhaseIdealLoop::clone_up_backedge_goo(Node *back_ctrl, Node *preheader_ctr
13091309 return n;
13101310}
13111311
1312- Node* PhaseIdealLoop::cast_incr_before_loop (Node* incr, Node* ctrl, Node* loop) {
1313- Node* castii = new CastIINode (ctrl, incr, TypeInt::INT, ConstraintCastNode::UnconditionalDependency);
1314- register_new_node (castii, ctrl);
1315- for (DUIterator_Fast imax, i = incr->fast_outs (imax); i < imax; i++) {
1316- Node* n = incr->fast_out (i);
1317- if (n->is_Phi () && n->in (0 ) == loop) {
1318- int nrep = n->replace_edge (incr, castii, &_igvn);
1319- return castii;
1320- }
1321- }
1322- return nullptr ;
1323- }
1324-
13251312#ifdef ASSERT
13261313void PhaseIdealLoop::ensure_zero_trip_guard_proj (Node* node, bool is_main_loop) {
13271314 assert (node->is_IfProj (), " must be the zero trip guard If node" );
@@ -1680,14 +1667,11 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
16801667 // variable value and the induction variable Phi to preserve correct
16811668 // dependencies.
16821669
1683- // CastII for the main loop:
1684- Node* castii = cast_incr_before_loop (pre_incr, min_taken, main_head);
1685- assert (castii != nullptr , " no castII inserted" );
16861670 assert (post_head->in (1 )->is_IfProj (), " must be zero-trip guard If node projection of the post loop" );
1687- copy_assertion_predicates_to_main_loop (pre_head, castii , stride, outer_loop, outer_main_head, dd_main_head,
1671+ copy_assertion_predicates_to_main_loop (pre_head, pre_incr , stride, outer_loop, outer_main_head, dd_main_head,
16881672 idx_before_pre_post, idx_after_post_before_pre, min_taken, post_head->in (1 ),
16891673 old_new);
1690- copy_assertion_predicates_to_post_loop (outer_main_head, post_head, post_incr, stride);
1674+ copy_assertion_predicates_to_post_loop (outer_main_head, post_head, stride);
16911675
16921676 // Step B4: Shorten the pre-loop to run only 1 iteration (for now).
16931677 // RCE and alignment may change this later.
@@ -1812,7 +1796,7 @@ void PhaseIdealLoop::insert_vector_post_loop(IdealLoopTree *loop, Node_List &old
18121796 // In this case we throw away the result as we are not using it to connect anything else.
18131797 CountedLoopNode *post_head = nullptr ;
18141798 insert_post_loop (loop, old_new, main_head, main_end, incr, limit, post_head);
1815- copy_assertion_predicates_to_post_loop (main_head->skip_strip_mined (), post_head, incr, main_head->stride ());
1799+ copy_assertion_predicates_to_post_loop (main_head->skip_strip_mined (), post_head, main_head->stride ());
18161800
18171801 // It's difficult to be precise about the trip-counts
18181802 // for post loops. They are usually very short,
@@ -1915,10 +1899,6 @@ Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree* loop, Node_List& old_new,
19151899 }
19161900 }
19171901
1918- // CastII for the new post loop:
1919- incr = cast_incr_before_loop (zer_opaq->in (1 ), zer_taken, post_head);
1920- assert (incr != nullptr , " no castII inserted" );
1921-
19221902 return new_main_exit;
19231903}
19241904
@@ -1934,12 +1914,6 @@ bool IdealLoopTree::is_invariant(Node* n) const {
19341914// to the new stride.
19351915void PhaseIdealLoop::update_main_loop_assertion_predicates (Node* ctrl, CountedLoopNode* loop_head, Node* init,
19361916 const int stride_con) {
1937- if (init->is_CastII ()) {
1938- // skip over the cast added by PhaseIdealLoop::cast_incr_before_loop() when pre/post/main loops are created because
1939- // it can get in the way of type propagation
1940- assert (init->as_CastII ()->carry_dependency () && loop_head->skip_assertion_predicates_with_halt () == init->in (0 ), " casted iv phi from pre loop expected" );
1941- init = init->in (1 );
1942- }
19431917 Node* entry = ctrl;
19441918 Node* prev_proj = ctrl;
19451919 LoopNode* outer_loop_head = loop_head->skip_strip_mined ();
@@ -1988,7 +1962,9 @@ void PhaseIdealLoop::update_main_loop_assertion_predicates(Node* ctrl, CountedLo
19881962// Go over the Assertion Predicates of the main loop and make a copy for the post loop with its initial iv value and
19891963// stride as inputs.
19901964void PhaseIdealLoop::copy_assertion_predicates_to_post_loop (LoopNode* main_loop_head, CountedLoopNode* post_loop_head,
1991- Node* init, Node* stride) {
1965+ Node* stride) {
1966+ Node* opaq = post_loop_head->is_canonical_loop_entry ();
1967+ Node* init = opaq->in (1 );
19921968 Node* post_loop_entry = post_loop_head->in (LoopNode::EntryControl);
19931969 Node* main_loop_entry = main_loop_head->in (LoopNode::EntryControl);
19941970 IdealLoopTree* post_loop = get_loop (post_loop_head);
0 commit comments