738 // Replace the old IfNode with a new LoopEndNode
739 Node *lex = _igvn.register_new_node_with_optimizer(new CountedLoopEndNode( iff->in(0), test, cl_prob, iff->as_If()->_fcnt ));
740 IfNode *le = lex->as_If();
741 uint dd = dom_depth(iff);
742 set_idom(le, le->in(0), dd); // Update dominance for loop exit
743 set_loop(le, loop);
744
745 // Get the loop-exit control
746 Node *iffalse = iff->as_If()->proj_out(!(iftrue_op == Op_IfTrue));
747
748 // Need to swap loop-exit and loop-back control?
749 if (iftrue_op == Op_IfFalse) {
750 Node *ift2=_igvn.register_new_node_with_optimizer(new IfTrueNode (le));
751 Node *iff2=_igvn.register_new_node_with_optimizer(new IfFalseNode(le));
752
753 loop->_tail = back_control = ift2;
754 set_loop(ift2, loop);
755 set_loop(iff2, get_loop(iffalse));
756
757 // Lazy update of 'get_ctrl' mechanism.
758 lazy_replace_proj( iffalse, iff2 );
759 lazy_replace_proj( iftrue, ift2 );
760
761 // Swap names
762 iffalse = iff2;
763 iftrue = ift2;
764 } else {
765 _igvn.rehash_node_delayed(iffalse);
766 _igvn.rehash_node_delayed(iftrue);
767 iffalse->set_req_X( 0, le, &_igvn );
768 iftrue ->set_req_X( 0, le, &_igvn );
769 }
770
771 set_idom(iftrue, le, dd+1);
772 set_idom(iffalse, le, dd+1);
773 assert(iff->outcnt() == 0, "should be dead now");
774 lazy_replace( iff, le ); // fix 'get_ctrl'
775
776 // Now setup a new CountedLoopNode to replace the existing LoopNode
777 CountedLoopNode *l = new CountedLoopNode(init_control, back_control);
778 l->set_unswitch_count(x->as_Loop()->unswitch_count()); // Preserve
779 // The following assert is approximately true, and defines the intention
|
738 // Replace the old IfNode with a new LoopEndNode
739 Node *lex = _igvn.register_new_node_with_optimizer(new CountedLoopEndNode( iff->in(0), test, cl_prob, iff->as_If()->_fcnt ));
740 IfNode *le = lex->as_If();
741 uint dd = dom_depth(iff);
742 set_idom(le, le->in(0), dd); // Update dominance for loop exit
743 set_loop(le, loop);
744
745 // Get the loop-exit control
746 Node *iffalse = iff->as_If()->proj_out(!(iftrue_op == Op_IfTrue));
747
748 // Need to swap loop-exit and loop-back control?
749 if (iftrue_op == Op_IfFalse) {
750 Node *ift2=_igvn.register_new_node_with_optimizer(new IfTrueNode (le));
751 Node *iff2=_igvn.register_new_node_with_optimizer(new IfFalseNode(le));
752
753 loop->_tail = back_control = ift2;
754 set_loop(ift2, loop);
755 set_loop(iff2, get_loop(iffalse));
756
757 // Lazy update of 'get_ctrl' mechanism.
758 lazy_replace(iffalse, iff2);
759 lazy_replace(iftrue, ift2);
760
761 // Swap names
762 iffalse = iff2;
763 iftrue = ift2;
764 } else {
765 _igvn.rehash_node_delayed(iffalse);
766 _igvn.rehash_node_delayed(iftrue);
767 iffalse->set_req_X( 0, le, &_igvn );
768 iftrue ->set_req_X( 0, le, &_igvn );
769 }
770
771 set_idom(iftrue, le, dd+1);
772 set_idom(iffalse, le, dd+1);
773 assert(iff->outcnt() == 0, "should be dead now");
774 lazy_replace( iff, le ); // fix 'get_ctrl'
775
776 // Now setup a new CountedLoopNode to replace the existing LoopNode
777 CountedLoopNode *l = new CountedLoopNode(init_control, back_control);
778 l->set_unswitch_count(x->as_Loop()->unswitch_count()); // Preserve
779 // The following assert is approximately true, and defines the intention
|