910 }
911
912 //------------------------------clone_up_backedge_goo--------------------------
913 // If Node n lives in the back_ctrl block and cannot float, we clone a private
914 // version of n in preheader_ctrl block and return that, otherwise return n.
915 Node *PhaseIdealLoop::clone_up_backedge_goo( Node *back_ctrl, Node *preheader_ctrl, Node *n, VectorSet &visited, Node_Stack &clones ) {
916 if( get_ctrl(n) != back_ctrl ) return n;
917
918 // Only visit once
919 if (visited.test_set(n->_idx)) {
920 Node *x = clones.find(n->_idx);
921 if (x != NULL)
922 return x;
923 return n;
924 }
925
926 Node *x = NULL; // If required, a clone of 'n'
927 // Check for 'n' being pinned in the backedge.
928 if( n->in(0) && n->in(0) == back_ctrl ) {
929 assert(clones.find(n->_idx) == NULL, "dead loop");
930 x = n->clone(); // Clone a copy of 'n' to preheader
931 clones.push(x, n->_idx);
932 x->set_req( 0, preheader_ctrl ); // Fix x's control input to preheader
933 }
934
935 // Recursive fixup any other input edges into x.
936 // If there are no changes we can just return 'n', otherwise
937 // we need to clone a private copy and change it.
938 for( uint i = 1; i < n->req(); i++ ) {
939 Node *g = clone_up_backedge_goo( back_ctrl, preheader_ctrl, n->in(i), visited, clones );
940 if( g != n->in(i) ) {
941 if( !x ) {
942 assert(clones.find(n->_idx) == NULL, "dead loop");
943 x = n->clone();
944 clones.push(x, n->_idx);
945 }
946 x->set_req(i, g);
947 }
948 }
949 if( x ) { // x can legally float to pre-header location
|
910 }
911
912 //------------------------------clone_up_backedge_goo--------------------------
913 // If Node n lives in the back_ctrl block and cannot float, we clone a private
914 // version of n in preheader_ctrl block and return that, otherwise return n.
915 Node *PhaseIdealLoop::clone_up_backedge_goo( Node *back_ctrl, Node *preheader_ctrl, Node *n, VectorSet &visited, Node_Stack &clones ) {
916 if( get_ctrl(n) != back_ctrl ) return n;
917
918 // Only visit once
919 if (visited.test_set(n->_idx)) {
920 Node *x = clones.find(n->_idx);
921 if (x != NULL)
922 return x;
923 return n;
924 }
925
926 Node *x = NULL; // If required, a clone of 'n'
927 // Check for 'n' being pinned in the backedge.
928 if( n->in(0) && n->in(0) == back_ctrl ) {
929 assert(clones.find(n->_idx) == NULL, "dead loop");
930 assert(n->Opcode() != Op_ShenandoahWriteBarrier, "no wbs yet");
931 x = n->clone(); // Clone a copy of 'n' to preheader
932 clones.push(x, n->_idx);
933 x->set_req( 0, preheader_ctrl ); // Fix x's control input to preheader
934 }
935
936 // Recursive fixup any other input edges into x.
937 // If there are no changes we can just return 'n', otherwise
938 // we need to clone a private copy and change it.
939 for( uint i = 1; i < n->req(); i++ ) {
940 Node *g = clone_up_backedge_goo( back_ctrl, preheader_ctrl, n->in(i), visited, clones );
941 if( g != n->in(i) ) {
942 if( !x ) {
943 assert(clones.find(n->_idx) == NULL, "dead loop");
944 x = n->clone();
945 clones.push(x, n->_idx);
946 }
947 x->set_req(i, g);
948 }
949 }
950 if( x ) { // x can legally float to pre-header location
|