< prev index next >

src/share/vm/opto/loopopts.cpp

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "opto/addnode.hpp"
  28 #include "opto/connode.hpp"
  29 #include "opto/divnode.hpp"
  30 #include "opto/loopnode.hpp"
  31 #include "opto/matcher.hpp"
  32 #include "opto/mulnode.hpp"
  33 #include "opto/movenode.hpp"
  34 #include "opto/opaquenode.hpp"
  35 #include "opto/rootnode.hpp"

  36 #include "opto/subnode.hpp"
  37 
  38 //=============================================================================
  39 //------------------------------split_thru_phi---------------------------------
  40 // Split Node 'n' through merge point if there is enough win.
  41 Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) {
  42   if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::LONG) {
  43     // ConvI2L may have type information on it which is unsafe to push up
  44     // so disable this for now
  45     return NULL;
  46   }
  47 
  48   int wins = 0;
  49   assert(!n->is_CFG(), "");
  50   assert(region->is_Region(), "");
  51 
  52   const Type* type = n->bottom_type();
  53   const TypeOopPtr *t_oop = _igvn.type(n)->isa_oopptr();
  54   Node *phi;
  55   if (t_oop != NULL && t_oop->is_known_instance_field()) {


  94       // irreducible loop may not be indicated by an affirmative is_Loop());
  95       // therefore, the only top we can split thru a phi is on a backedge of
  96       // a loop.
  97       singleton &= region->is_Loop() && (i != LoopNode::EntryControl);
  98     }
  99 
 100     if (singleton) {
 101       wins++;
 102       x = ((PhaseGVN&)_igvn).makecon(t);
 103     } else {
 104       // We now call Identity to try to simplify the cloned node.
 105       // Note that some Identity methods call phase->type(this).
 106       // Make sure that the type array is big enough for
 107       // our new node, even though we may throw the node away.
 108       // (Note: This tweaking with igvn only works because x is a new node.)
 109       _igvn.set_type(x, t);
 110       // If x is a TypeNode, capture any more-precise type permanently into Node
 111       // otherwise it will be not updated during igvn->transform since
 112       // igvn->type(x) is set to x->Value() already.
 113       x->raise_bottom_type(t);

 114       Node *y = x->Identity(&_igvn);
 115       if (y != x) {
 116         wins++;
 117         x = y;
 118       } else {
 119         y = _igvn.hash_find(x);
 120         if (y) {
 121           wins++;
 122           x = y;
 123         } else {
 124           // Else x is a new node we are keeping
 125           // We do not need register_new_node_with_optimizer
 126           // because set_type has already been called.
 127           _igvn._worklist.push(x);
 128         }
 129       }



 130     }
 131     if (x != the_clone && the_clone != NULL)
 132       _igvn.remove_dead_node(the_clone);
 133     phi->set_req( i, x );
 134   }
 135   // Too few wins?
 136   if (wins <= policy) {
 137     _igvn.remove_dead_node(phi);
 138     return NULL;
 139   }
 140 
 141   // Record Phi
 142   register_new_node( phi, region );
 143 
 144   for (uint i2 = 1; i2 < phi->req(); i2++) {
 145     Node *x = phi->in(i2);
 146     // If we commoned up the cloned 'x' with another existing Node,
 147     // the existing Node picks up a new use.  We need to make the
 148     // existing Node occur higher up so it dominates its uses.
 149     Node *old_ctrl;


 177         (old_loop == NULL || !new_loop->is_member(old_loop))) {
 178       // Take early control, later control will be recalculated
 179       // during next iteration of loop optimizations.
 180       new_ctrl = get_early_ctrl(x);
 181       new_loop = get_loop(new_ctrl);
 182     }
 183     // Set new location
 184     set_ctrl(x, new_ctrl);
 185     // If changing loop bodies, see if we need to collect into new body
 186     if (old_loop != new_loop) {
 187       if (old_loop && !old_loop->_child)
 188         old_loop->_body.yank(x);
 189       if (!new_loop->_child)
 190         new_loop->_body.push(x);  // Collect body info
 191     }
 192   }
 193 
 194   return phi;
 195 }
 196 






































 197 //------------------------------dominated_by------------------------------------
 198 // Replace the dominated test with an obvious true or false.  Place it on the
 199 // IGVN worklist for later cleanup.  Move control-dependent data Nodes on the
 200 // live path up to the dominating control.
 201 void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exclude_loop_predicate ) {
 202 #ifndef PRODUCT
 203   if (VerifyLoopOptimizations && PrintOpto) tty->print_cr("dominating test");
 204 #endif
 205 
 206 
 207   // prevdom is the dominating projection of the dominating test.
 208   assert( iff->is_If(), "" );
 209   assert( iff->Opcode() == Op_If || iff->Opcode() == Op_CountedLoopEnd, "Check this code when new subtype is added");
 210   int pop = prevdom->Opcode();
 211   assert( pop == Op_IfFalse || pop == Op_IfTrue, "" );
 212   if (flip) {
 213     if (pop == Op_IfTrue)
 214       pop = Op_IfFalse;
 215     else
 216       pop = Op_IfTrue;


 917   int policy = n_blk->req() >> 2;
 918 
 919   // If the loop is a candidate for range check elimination,
 920   // delay splitting through it's phi until a later loop optimization
 921   if (n_blk->is_CountedLoop()) {
 922     IdealLoopTree *lp = get_loop(n_blk);
 923     if (lp && lp->_rce_candidate) {
 924       return n;
 925     }
 926   }
 927 
 928   // Use same limit as split_if_with_blocks_post
 929   if( C->live_nodes() > 35000 ) return n; // Method too big
 930 
 931   // Split 'n' through the merge point if it is profitable
 932   Node *phi = split_thru_phi( n, n_blk, policy );
 933   if (!phi) return n;
 934 
 935   // Found a Phi to split thru!
 936   // Replace 'n' with the new phi

 937   _igvn.replace_node( n, phi );
 938   // Moved a load around the loop, 'en-registering' something.
 939   if (n_blk->is_Loop() && n->is_Load() &&
 940       !phi->in(LoopNode::LoopBackControl)->is_Load())
 941     C->set_major_progress();
 942 





 943   return phi;
 944 }
 945 
 946 static bool merge_point_too_heavy(Compile* C, Node* region) {
 947   // Bail out if the region and its phis have too many users.
 948   int weight = 0;
 949   for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
 950     weight += region->fast_out(i)->outcnt();
 951   }
 952   int nodes_left = C->max_node_limit() - C->live_nodes();
 953   if (weight * 8 > nodes_left) {
 954 #ifndef PRODUCT
 955     if (PrintOpto)
 956       tty->print_cr("*** Split-if bails out:  %d nodes, region weight %d", C->unique(), weight);
 957 #endif
 958     return true;
 959   } else {
 960     return false;
 961   }
 962 }


1212               // Don't allow the control input to be a CFG splitting node.
1213               // Such nodes should only have ProjNodes as outs, e.g. IfNode
1214               // should only have IfTrueNode and IfFalseNode (4985384).
1215               x_ctrl = find_non_split_ctrl(x_ctrl);
1216               assert(dom_depth(n_ctrl) <= dom_depth(x_ctrl), "n is later than its clone");
1217 
1218               x->set_req(0, x_ctrl);
1219             }
1220             register_new_node(x, x_ctrl);
1221 
1222             // Some institutional knowledge is needed here: 'x' is
1223             // yanked because if the optimizer runs GVN on it all the
1224             // cloned x's will common up and undo this optimization and
1225             // be forced back in the loop.  This is annoying because it
1226             // makes +VerifyOpto report false-positives on progress.  I
1227             // tried setting control edges on the x's to force them to
1228             // not combine, but the matching gets worried when it tries
1229             // to fold a StoreP and an AddP together (as part of an
1230             // address expression) and the AddP and StoreP have
1231             // different controls.
1232             if (!x->is_Load() && !x->is_DecodeNarrowPtr()) _igvn._worklist.yank(x);
1233           }
1234           _igvn.remove_dead_node(n);
1235         }
1236       }
1237     }
1238   }
1239 
1240   try_move_store_after_loop(n);
1241 
1242   // Check for Opaque2's who's loop has disappeared - who's input is in the
1243   // same loop nest as their output.  Remove 'em, they are no longer useful.
1244   if( n_op == Op_Opaque2 &&
1245       n->in(1) != NULL &&
1246       get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) {
1247     _igvn.replace_node( n, n->in(1) );
1248   }
1249 }
1250 
1251 //------------------------------split_if_with_blocks---------------------------
1252 // Check for aggressive application of 'split-if' optimization,


1675           : idom(prev);
1676         if( use->is_Phi() )     // Phi use is in prior block
1677           cfg = prev->in(idx);  // NOT in block of Phi itself
1678         if (cfg->is_top()) {    // Use is dead?
1679           _igvn.replace_input_of(use, idx, C->top());
1680           continue;
1681         }
1682 
1683         while( !loop->is_member( get_loop( cfg ) ) ) {
1684           prev = cfg;
1685           cfg = cfg->_idx >= new_counter ? cfg->in(2) : idom(cfg);
1686         }
1687         // If the use occurs after merging several exits from the loop, then
1688         // old value must have dominated all those exits.  Since the same old
1689         // value was used on all those exits we did not need a Phi at this
1690         // merge point.  NOW we do need a Phi here.  Each loop exit value
1691         // is now merged with the peeled body exit; each exit gets its own
1692         // private Phi and those Phis need to be merged here.
1693         Node *phi;
1694         if( prev->is_Region() ) {
1695           if( idx == 0 ) {      // Updating control edge?
1696             phi = prev;         // Just use existing control
1697           } else {              // Else need a new Phi
1698             phi = PhiNode::make( prev, old );
1699             // Now recursively fix up the new uses of old!
1700             for( uint i = 1; i < prev->req(); i++ ) {

1701               worklist.push(phi); // Onto worklist once for each 'old' input
1702             }
1703           }
1704         } else {
1705           // Get new RegionNode merging old and new loop exits
1706           prev = old_new[prev->_idx];
1707           assert( prev, "just made this in step 7" );
1708           if( idx == 0 ) {      // Updating control edge?
1709             phi = prev;         // Just use existing control
1710           } else {              // Else need a new Phi
1711             // Make a new Phi merging data values properly
1712             phi = PhiNode::make( prev, old );
1713             phi->set_req( 1, nnn );
1714           }
1715         }
1716         // If inserting a new Phi, check for prior hits
1717         if( idx != 0 ) {
1718           Node *hit = _igvn.hash_find_insert(phi);
1719           if( hit == NULL ) {
1720            _igvn.register_new_node_with_optimizer(phi); // Register new phi
1721           } else {                                      // or
1722             // Remove the new phi from the graph and use the hit
1723             _igvn.remove_dead_node(phi);
1724             phi = hit;                                  // Use existing phi
1725           }
1726           set_ctrl(phi, prev);
1727         }
1728         // Make 'use' use the Phi instead of the old loop body exit value




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "opto/addnode.hpp"
  28 #include "opto/connode.hpp"
  29 #include "opto/divnode.hpp"
  30 #include "opto/loopnode.hpp"
  31 #include "opto/matcher.hpp"
  32 #include "opto/mulnode.hpp"
  33 #include "opto/movenode.hpp"
  34 #include "opto/opaquenode.hpp"
  35 #include "opto/rootnode.hpp"
  36 #include "opto/shenandoahSupport.hpp"
  37 #include "opto/subnode.hpp"
  38 
  39 //=============================================================================
  40 //------------------------------split_thru_phi---------------------------------
  41 // Split Node 'n' through merge point if there is enough win.
  42 Node *PhaseIdealLoop::split_thru_phi( Node *n, Node *region, int policy ) {
  43   if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::LONG) {
  44     // ConvI2L may have type information on it which is unsafe to push up
  45     // so disable this for now
  46     return NULL;
  47   }
  48 
  49   int wins = 0;
  50   assert(!n->is_CFG(), "");
  51   assert(region->is_Region(), "");
  52 
  53   const Type* type = n->bottom_type();
  54   const TypeOopPtr *t_oop = _igvn.type(n)->isa_oopptr();
  55   Node *phi;
  56   if (t_oop != NULL && t_oop->is_known_instance_field()) {


  95       // irreducible loop may not be indicated by an affirmative is_Loop());
  96       // therefore, the only top we can split thru a phi is on a backedge of
  97       // a loop.
  98       singleton &= region->is_Loop() && (i != LoopNode::EntryControl);
  99     }
 100 
 101     if (singleton) {
 102       wins++;
 103       x = ((PhaseGVN&)_igvn).makecon(t);
 104     } else {
 105       // We now call Identity to try to simplify the cloned node.
 106       // Note that some Identity methods call phase->type(this).
 107       // Make sure that the type array is big enough for
 108       // our new node, even though we may throw the node away.
 109       // (Note: This tweaking with igvn only works because x is a new node.)
 110       _igvn.set_type(x, t);
 111       // If x is a TypeNode, capture any more-precise type permanently into Node
 112       // otherwise it will be not updated during igvn->transform since
 113       // igvn->type(x) is set to x->Value() already.
 114       x->raise_bottom_type(t);
 115       if (x->Opcode() != Op_ShenandoahWriteBarrier) {
 116         Node *y = x->Identity(&_igvn);
 117         if (y != x) {
 118           wins++;
 119           x = y;
 120         } else {
 121           y = _igvn.hash_find(x);
 122           if (y) {
 123             wins++;
 124             x = y;
 125           } else {
 126             // Else x is a new node we are keeping
 127             // We do not need register_new_node_with_optimizer
 128             // because set_type has already been called.
 129             _igvn._worklist.push(x);
 130           }
 131         }
 132       } else {
 133         _igvn._worklist.push(x);
 134       }
 135     }
 136     if (x != the_clone && the_clone != NULL)
 137       _igvn.remove_dead_node(the_clone);
 138     phi->set_req( i, x );
 139   }
 140   // Too few wins?
 141   if (wins <= policy) {
 142     _igvn.remove_dead_node(phi);
 143     return NULL;
 144   }
 145 
 146   // Record Phi
 147   register_new_node( phi, region );
 148 
 149   for (uint i2 = 1; i2 < phi->req(); i2++) {
 150     Node *x = phi->in(i2);
 151     // If we commoned up the cloned 'x' with another existing Node,
 152     // the existing Node picks up a new use.  We need to make the
 153     // existing Node occur higher up so it dominates its uses.
 154     Node *old_ctrl;


 182         (old_loop == NULL || !new_loop->is_member(old_loop))) {
 183       // Take early control, later control will be recalculated
 184       // during next iteration of loop optimizations.
 185       new_ctrl = get_early_ctrl(x);
 186       new_loop = get_loop(new_ctrl);
 187     }
 188     // Set new location
 189     set_ctrl(x, new_ctrl);
 190     // If changing loop bodies, see if we need to collect into new body
 191     if (old_loop != new_loop) {
 192       if (old_loop && !old_loop->_child)
 193         old_loop->_body.yank(x);
 194       if (!new_loop->_child)
 195         new_loop->_body.push(x);  // Collect body info
 196     }
 197   }
 198 
 199   return phi;
 200 }
 201 
 202 /**
 203  * When splitting a Shenandoah write barrier through a phi, we
 204  * can not replace the write-barrier input of the ShenandoahWBMemProj
 205  * with the phi. We must also split the ShenandoahWBMemProj through the
 206  * phi and generate a new memory phi for it.
 207  */
 208 void PhaseIdealLoop::split_mem_thru_phi(Node* n, Node* r, Node* phi) {
 209   if (n->Opcode() == Op_ShenandoahWriteBarrier) {
 210     if (n->has_out_with(Op_ShenandoahWBMemProj)) {
 211       Node* old_mem_phi = n->in(ShenandoahBarrierNode::Memory);
 212       assert(r->is_Region(), "need region to control phi");
 213       assert(phi->is_Phi(), "expect phi");
 214       Node* memphi = PhiNode::make(r, old_mem_phi, Type::MEMORY, C->alias_type(n->adr_type())->adr_type());
 215       for (uint i = 1; i < r->req(); i++) {
 216         Node* wb = phi->in(i);
 217         if (wb->Opcode() == Op_ShenandoahWriteBarrier) {
 218           // assert(! wb->has_out_with(Op_ShenandoahWBMemProj), "new clone does not have mem proj");
 219           Node* new_proj = new ShenandoahWBMemProjNode(wb);
 220           register_new_node(new_proj, r->in(i));
 221           memphi->set_req(i, new_proj);
 222         } else {
 223           if (old_mem_phi->is_Phi() && old_mem_phi->in(0) == r) {
 224             memphi->set_req(i, old_mem_phi->in(i));
 225           }
 226         }
 227       }
 228       register_new_node(memphi, r);
 229       Node* old_mem_out = n->find_out_with(Op_ShenandoahWBMemProj);
 230       while (old_mem_out != NULL) {
 231         assert(old_mem_out != NULL, "expect memory projection");
 232         _igvn.replace_node(old_mem_out, memphi);
 233         old_mem_out = n->find_out_with(Op_ShenandoahWBMemProj);
 234       }
 235     }
 236     assert(! n->has_out_with(Op_ShenandoahWBMemProj), "no more memory outs");
 237   }
 238 }
 239 
 240 //------------------------------dominated_by------------------------------------
 241 // Replace the dominated test with an obvious true or false.  Place it on the
 242 // IGVN worklist for later cleanup.  Move control-dependent data Nodes on the
 243 // live path up to the dominating control.
 244 void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exclude_loop_predicate ) {
 245 #ifndef PRODUCT
 246   if (VerifyLoopOptimizations && PrintOpto) tty->print_cr("dominating test");
 247 #endif
 248 
 249 
 250   // prevdom is the dominating projection of the dominating test.
 251   assert( iff->is_If(), "" );
 252   assert( iff->Opcode() == Op_If || iff->Opcode() == Op_CountedLoopEnd, "Check this code when new subtype is added");
 253   int pop = prevdom->Opcode();
 254   assert( pop == Op_IfFalse || pop == Op_IfTrue, "" );
 255   if (flip) {
 256     if (pop == Op_IfTrue)
 257       pop = Op_IfFalse;
 258     else
 259       pop = Op_IfTrue;


 960   int policy = n_blk->req() >> 2;
 961 
 962   // If the loop is a candidate for range check elimination,
 963   // delay splitting through it's phi until a later loop optimization
 964   if (n_blk->is_CountedLoop()) {
 965     IdealLoopTree *lp = get_loop(n_blk);
 966     if (lp && lp->_rce_candidate) {
 967       return n;
 968     }
 969   }
 970 
 971   // Use same limit as split_if_with_blocks_post
 972   if( C->live_nodes() > 35000 ) return n; // Method too big
 973 
 974   // Split 'n' through the merge point if it is profitable
 975   Node *phi = split_thru_phi( n, n_blk, policy );
 976   if (!phi) return n;
 977 
 978   // Found a Phi to split thru!
 979   // Replace 'n' with the new phi
 980   split_mem_thru_phi(n, n_blk, phi);
 981   _igvn.replace_node( n, phi );
 982   // Moved a load around the loop, 'en-registering' something.
 983   if (n_blk->is_Loop() && n->is_Load() &&
 984       !phi->in(LoopNode::LoopBackControl)->is_Load())
 985     C->set_major_progress();
 986 
 987   // Moved a barrier around the loop, 'en-registering' something.
 988   if (n_blk->is_Loop() && n->is_ShenandoahBarrier() &&
 989       !phi->in(LoopNode::LoopBackControl)->is_ShenandoahBarrier())
 990     C->set_major_progress();
 991 
 992   return phi;
 993 }
 994 
 995 static bool merge_point_too_heavy(Compile* C, Node* region) {
 996   // Bail out if the region and its phis have too many users.
 997   int weight = 0;
 998   for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
 999     weight += region->fast_out(i)->outcnt();
1000   }
1001   int nodes_left = C->max_node_limit() - C->live_nodes();
1002   if (weight * 8 > nodes_left) {
1003 #ifndef PRODUCT
1004     if (PrintOpto)
1005       tty->print_cr("*** Split-if bails out:  %d nodes, region weight %d", C->unique(), weight);
1006 #endif
1007     return true;
1008   } else {
1009     return false;
1010   }
1011 }


1261               // Don't allow the control input to be a CFG splitting node.
1262               // Such nodes should only have ProjNodes as outs, e.g. IfNode
1263               // should only have IfTrueNode and IfFalseNode (4985384).
1264               x_ctrl = find_non_split_ctrl(x_ctrl);
1265               assert(dom_depth(n_ctrl) <= dom_depth(x_ctrl), "n is later than its clone");
1266 
1267               x->set_req(0, x_ctrl);
1268             }
1269             register_new_node(x, x_ctrl);
1270 
1271             // Some institutional knowledge is needed here: 'x' is
1272             // yanked because if the optimizer runs GVN on it all the
1273             // cloned x's will common up and undo this optimization and
1274             // be forced back in the loop.  This is annoying because it
1275             // makes +VerifyOpto report false-positives on progress.  I
1276             // tried setting control edges on the x's to force them to
1277             // not combine, but the matching gets worried when it tries
1278             // to fold a StoreP and an AddP together (as part of an
1279             // address expression) and the AddP and StoreP have
1280             // different controls.
1281             if (!x->is_Load() && !x->is_DecodeNarrowPtr() && !x->is_ShenandoahBarrier()) _igvn._worklist.yank(x);
1282           }
1283           _igvn.remove_dead_node(n);
1284         }
1285       }
1286     }
1287   }
1288 
1289   try_move_store_after_loop(n);
1290 
1291   // Check for Opaque2's who's loop has disappeared - who's input is in the
1292   // same loop nest as their output.  Remove 'em, they are no longer useful.
1293   if( n_op == Op_Opaque2 &&
1294       n->in(1) != NULL &&
1295       get_loop(get_ctrl(n)) == get_loop(get_ctrl(n->in(1))) ) {
1296     _igvn.replace_node( n, n->in(1) );
1297   }
1298 }
1299 
1300 //------------------------------split_if_with_blocks---------------------------
1301 // Check for aggressive application of 'split-if' optimization,


1724           : idom(prev);
1725         if( use->is_Phi() )     // Phi use is in prior block
1726           cfg = prev->in(idx);  // NOT in block of Phi itself
1727         if (cfg->is_top()) {    // Use is dead?
1728           _igvn.replace_input_of(use, idx, C->top());
1729           continue;
1730         }
1731 
1732         while( !loop->is_member( get_loop( cfg ) ) ) {
1733           prev = cfg;
1734           cfg = cfg->_idx >= new_counter ? cfg->in(2) : idom(cfg);
1735         }
1736         // If the use occurs after merging several exits from the loop, then
1737         // old value must have dominated all those exits.  Since the same old
1738         // value was used on all those exits we did not need a Phi at this
1739         // merge point.  NOW we do need a Phi here.  Each loop exit value
1740         // is now merged with the peeled body exit; each exit gets its own
1741         // private Phi and those Phis need to be merged here.
1742         Node *phi;
1743         if( prev->is_Region() ) {
1744           if( idx == 0  && use->Opcode() != Op_ShenandoahWBMemProj) {      // Updating control edge?
1745             phi = prev;         // Just use existing control
1746           } else {              // Else need a new Phi
1747             phi = PhiNode::make( prev, old );
1748             // Now recursively fix up the new uses of old!
1749             uint first = use->Opcode() != Op_ShenandoahWBMemProj ? 1 : 0;
1750             for( uint i = first; i < prev->req(); i++ ) {
1751               worklist.push(phi); // Onto worklist once for each 'old' input
1752             }
1753           }
1754         } else {
1755           // Get new RegionNode merging old and new loop exits
1756           prev = old_new[prev->_idx];
1757           assert( prev, "just made this in step 7" );
1758           if( idx == 0 && use->Opcode() != Op_ShenandoahWBMemProj) {      // Updating control edge?
1759             phi = prev;         // Just use existing control
1760           } else {              // Else need a new Phi
1761             // Make a new Phi merging data values properly
1762             phi = PhiNode::make( prev, old );
1763             phi->set_req( 1, nnn );
1764           }
1765         }
1766         // If inserting a new Phi, check for prior hits
1767         if( idx != 0 ) {
1768           Node *hit = _igvn.hash_find_insert(phi);
1769           if( hit == NULL ) {
1770            _igvn.register_new_node_with_optimizer(phi); // Register new phi
1771           } else {                                      // or
1772             // Remove the new phi from the graph and use the hit
1773             _igvn.remove_dead_node(phi);
1774             phi = hit;                                  // Use existing phi
1775           }
1776           set_ctrl(phi, prev);
1777         }
1778         // Make 'use' use the Phi instead of the old loop body exit value


< prev index next >