173 // it will then "split-up".
174 for (DUIterator_Fast imax,i = memphi->fast_outs(imax); i < imax; i++) {
175 Node *load = memphi->fast_out(i);
176 if( load->is_Load() && alias_idx == C->get_alias_index(_igvn.type(load->in(MemNode::Address))->is_ptr()) )
177 set_ctrl(load,blk1);
178 }
179 }
180
181 // Found some other Node; must clone it up
182 #ifndef PRODUCT
183 if( PrintOpto && VerifyLoopOptimizations ) {
184 tty->print("Cloning up: ");
185 n->dump();
186 }
187 #endif
188
189 // ConvI2L may have type information on it which becomes invalid if
190 // it moves up in the graph so change any clones so widen the type
191 // to TypeLong::INT when pushing it up.
192 const Type* rtype = NULL;
193 if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::INT) {
194 rtype = TypeLong::INT;
195 }
196
197 // Now actually split-up this guy. One copy per control path merging.
198 Node *phi = PhiNode::make_blank(blk1, n);
199 for( uint j = 1; j < blk1->req(); j++ ) {
200 Node *x = n->clone();
201 // Widen the type of the ConvI2L when pushing up.
202 if (rtype != NULL) x->as_Type()->set_type(rtype);
203 if( n->in(0) && n->in(0) == blk1 )
204 x->set_req( 0, blk1->in(j) );
205 for( uint i = 1; i < n->req(); i++ ) {
206 Node *m = n->in(i);
207 if( get_ctrl(m) == blk1 ) {
208 assert( m->in(0) == blk1, "" );
209 x->set_req( i, m->in(j) );
210 }
211 }
212 register_new_node( x, blk1->in(j) );
213 phi->init_req( j, x );
438 }
439 // Something unpredictable changed.
440 // Tell the iterators to refresh themselves, and rerun the loop.
441 i = region->refresh_out_pos(i);
442 j = region->refresh_out_pos(j);
443 progress = true;
444 }
445 }
446 }
447
448 // Now we have no instructions in the block containing the IF.
449 // Split the IF.
450 Node *new_iff = split_thru_region( iff, region );
451
452 // Replace both uses of 'new_iff' with Regions merging True/False
453 // paths. This makes 'new_iff' go dead.
454 Node *old_false = NULL, *old_true = NULL;
455 Node *new_false = NULL, *new_true = NULL;
456 for (DUIterator_Last j2min, j2 = iff->last_outs(j2min); j2 >= j2min; --j2) {
457 Node *ifp = iff->last_out(j2);
458 assert( ifp->Opcode() == Op_IfFalse || ifp->Opcode() == Op_IfTrue, "" );
459 ifp->set_req(0, new_iff);
460 Node *ifpx = split_thru_region( ifp, region );
461
462 // Replace 'If' projection of a Region with a Region of
463 // 'If' projections.
464 ifpx->set_req(0, ifpx); // A TRUE RegionNode
465
466 // Setup dominator info
467 set_idom(ifpx, region_dom, dom_depth(region_dom) + 1);
468
469 // Check for splitting loop tails
470 if( get_loop(iff)->tail() == ifp )
471 get_loop(iff)->_tail = ifpx;
472
473 // Replace in the graph with lazy-update mechanism
474 new_iff->set_req(0, new_iff); // hook self so it does not go dead
475 lazy_replace(ifp, ifpx);
476 new_iff->set_req(0, region);
477
478 // Record bits for later xforms
479 if( ifp->Opcode() == Op_IfFalse ) {
480 old_false = ifp;
481 new_false = ifpx;
482 } else {
483 old_true = ifp;
484 new_true = ifpx;
485 }
486 }
487 _igvn.remove_dead_node(new_iff);
488 // Lazy replace IDOM info with the region's dominator
489 lazy_replace( iff, region_dom );
490
491 // Now make the original merge point go dead, by handling all its uses.
492 small_cache region_cache;
493 // Preload some control flow in region-cache
494 region_cache.lru_insert( new_false, new_false );
495 region_cache.lru_insert( new_true , new_true );
496 // Now handle all uses of the splitting block
497 for (DUIterator k = region->outs(); region->has_out(k); k++) {
498 Node* phi = region->out(k);
499 if (!phi->in(0)) { // Dead phi? Remove it
|
173 // it will then "split-up".
174 for (DUIterator_Fast imax,i = memphi->fast_outs(imax); i < imax; i++) {
175 Node *load = memphi->fast_out(i);
176 if( load->is_Load() && alias_idx == C->get_alias_index(_igvn.type(load->in(MemNode::Address))->is_ptr()) )
177 set_ctrl(load,blk1);
178 }
179 }
180
181 // Found some other Node; must clone it up
182 #ifndef PRODUCT
183 if( PrintOpto && VerifyLoopOptimizations ) {
184 tty->print("Cloning up: ");
185 n->dump();
186 }
187 #endif
188
189 // ConvI2L may have type information on it which becomes invalid if
190 // it moves up in the graph so change any clones so widen the type
191 // to TypeLong::INT when pushing it up.
192 const Type* rtype = NULL;
193 if (n->Opcode() == Opcodes::Op_ConvI2L && n->bottom_type() != TypeLong::INT) {
194 rtype = TypeLong::INT;
195 }
196
197 // Now actually split-up this guy. One copy per control path merging.
198 Node *phi = PhiNode::make_blank(blk1, n);
199 for( uint j = 1; j < blk1->req(); j++ ) {
200 Node *x = n->clone();
201 // Widen the type of the ConvI2L when pushing up.
202 if (rtype != NULL) x->as_Type()->set_type(rtype);
203 if( n->in(0) && n->in(0) == blk1 )
204 x->set_req( 0, blk1->in(j) );
205 for( uint i = 1; i < n->req(); i++ ) {
206 Node *m = n->in(i);
207 if( get_ctrl(m) == blk1 ) {
208 assert( m->in(0) == blk1, "" );
209 x->set_req( i, m->in(j) );
210 }
211 }
212 register_new_node( x, blk1->in(j) );
213 phi->init_req( j, x );
438 }
439 // Something unpredictable changed.
440 // Tell the iterators to refresh themselves, and rerun the loop.
441 i = region->refresh_out_pos(i);
442 j = region->refresh_out_pos(j);
443 progress = true;
444 }
445 }
446 }
447
448 // Now we have no instructions in the block containing the IF.
449 // Split the IF.
450 Node *new_iff = split_thru_region( iff, region );
451
452 // Replace both uses of 'new_iff' with Regions merging True/False
453 // paths. This makes 'new_iff' go dead.
454 Node *old_false = NULL, *old_true = NULL;
455 Node *new_false = NULL, *new_true = NULL;
456 for (DUIterator_Last j2min, j2 = iff->last_outs(j2min); j2 >= j2min; --j2) {
457 Node *ifp = iff->last_out(j2);
458 assert( ifp->Opcode() == Opcodes::Op_IfFalse || ifp->Opcode() == Opcodes::Op_IfTrue, "" );
459 ifp->set_req(0, new_iff);
460 Node *ifpx = split_thru_region( ifp, region );
461
462 // Replace 'If' projection of a Region with a Region of
463 // 'If' projections.
464 ifpx->set_req(0, ifpx); // A TRUE RegionNode
465
466 // Setup dominator info
467 set_idom(ifpx, region_dom, dom_depth(region_dom) + 1);
468
469 // Check for splitting loop tails
470 if( get_loop(iff)->tail() == ifp )
471 get_loop(iff)->_tail = ifpx;
472
473 // Replace in the graph with lazy-update mechanism
474 new_iff->set_req(0, new_iff); // hook self so it does not go dead
475 lazy_replace(ifp, ifpx);
476 new_iff->set_req(0, region);
477
478 // Record bits for later xforms
479 if( ifp->Opcode() == Opcodes::Op_IfFalse ) {
480 old_false = ifp;
481 new_false = ifpx;
482 } else {
483 old_true = ifp;
484 new_true = ifpx;
485 }
486 }
487 _igvn.remove_dead_node(new_iff);
488 // Lazy replace IDOM info with the region's dominator
489 lazy_replace( iff, region_dom );
490
491 // Now make the original merge point go dead, by handling all its uses.
492 small_cache region_cache;
493 // Preload some control flow in region-cache
494 region_cache.lru_insert( new_false, new_false );
495 region_cache.lru_insert( new_true , new_true );
496 // Now handle all uses of the splitting block
497 for (DUIterator k = region->outs(); region->has_out(k); k++) {
498 Node* phi = region->out(k);
499 if (!phi->in(0)) { // Dead phi? Remove it
|