56 r->set_req(0,region); // Not a TRUE RegionNode
57 _igvn.register_new_node_with_optimizer(r);
58 set_loop(r, loop);
59 if( !loop->_child )
60 loop->_body.push(r);
61 return r;
62 }
63
64 //------------------------------split_up---------------------------------------
65 // Split block-local op up through the phis to empty the current block
66 bool PhaseIdealLoop::split_up( Node *n, Node *blk1, Node *blk2 ) {
67 if( n->is_CFG() ) {
68 assert( n->in(0) != blk1, "Lousy candidate for split-if" );
69 return false;
70 }
71 if( get_ctrl(n) != blk1 && get_ctrl(n) != blk2 )
72 return false; // Not block local
73 if( n->is_Phi() ) return false; // Local PHIs are expected
74
75 // Recursively split-up inputs
76 for (uint i = 1; i < n->req(); i++) {
77 if( split_up( n->in(i), blk1, blk2 ) ) {
78 // Got split recursively and self went dead?
79 if (n->outcnt() == 0)
80 _igvn.remove_dead_node(n);
81 return true;
82 }
83 }
84
85 // Check for needing to clone-up a compare. Can't do that, it forces
86 // another (nested) split-if transform. Instead, clone it "down".
87 if( n->is_Cmp() ) {
88 assert(get_ctrl(n) == blk2 || get_ctrl(n) == blk1, "must be in block with IF");
89 // Check for simple Cmp/Bool/CMove which we can clone-up. Cmp/Bool/CMove
90 // sequence can have no other users and it must all reside in the split-if
91 // block. Non-simple Cmp/Bool/CMove sequences are 'cloned-down' below -
92 // private, per-use versions of the Cmp and Bool are made. These sink to
93 // the CMove block. If the CMove is in the split-if block, then in the
94 // next iteration this will become a simple Cmp/Bool/CMove set to clone-up.
95 Node *bol, *cmov;
96 if( !(n->outcnt() == 1 && n->unique_out()->is_Bool() &&
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 );
214 }
215 // Announce phi to optimizer
216 register_new_node(phi, blk1);
217
218 // Remove cloned-up value from optimizer; use phi instead
219 _igvn.replace_node( n, phi );
220
221 // (There used to be a self-recursive call to split_up() here,
222 // but it is not needed. All necessary forward walking is done
223 // by do_split_if() below.)
224
225 return true;
226 }
227
228 //------------------------------register_new_node------------------------------
229 void PhaseIdealLoop::register_new_node( Node *n, Node *blk ) {
230 assert(!n->is_CFG(), "must be data node");
231 _igvn.register_new_node_with_optimizer(n);
232 set_ctrl(n, blk);
233 IdealLoopTree *loop = get_loop(blk);
234 if( !loop->_child )
235 loop->_body.push(n);
236 }
237
238 //------------------------------small_cache------------------------------------
|
56 r->set_req(0,region); // Not a TRUE RegionNode
57 _igvn.register_new_node_with_optimizer(r);
58 set_loop(r, loop);
59 if( !loop->_child )
60 loop->_body.push(r);
61 return r;
62 }
63
64 //------------------------------split_up---------------------------------------
65 // Split block-local op up through the phis to empty the current block
66 bool PhaseIdealLoop::split_up( Node *n, Node *blk1, Node *blk2 ) {
67 if( n->is_CFG() ) {
68 assert( n->in(0) != blk1, "Lousy candidate for split-if" );
69 return false;
70 }
71 if( get_ctrl(n) != blk1 && get_ctrl(n) != blk2 )
72 return false; // Not block local
73 if( n->is_Phi() ) return false; // Local PHIs are expected
74
75 // Recursively split-up inputs
76 uint first_input = n->Opcode() == Op_ShenandoahWBMemProj ? 0 : 1;
77 for (uint i = first_input; i < n->req(); i++) {
78 if( split_up( n->in(i), blk1, blk2 ) ) {
79 // Got split recursively and self went dead?
80 if (n->outcnt() == 0)
81 _igvn.remove_dead_node(n);
82 return true;
83 }
84 }
85
86 // Check for needing to clone-up a compare. Can't do that, it forces
87 // another (nested) split-if transform. Instead, clone it "down".
88 if( n->is_Cmp() ) {
89 assert(get_ctrl(n) == blk2 || get_ctrl(n) == blk1, "must be in block with IF");
90 // Check for simple Cmp/Bool/CMove which we can clone-up. Cmp/Bool/CMove
91 // sequence can have no other users and it must all reside in the split-if
92 // block. Non-simple Cmp/Bool/CMove sequences are 'cloned-down' below -
93 // private, per-use versions of the Cmp and Bool are made. These sink to
94 // the CMove block. If the CMove is in the split-if block, then in the
95 // next iteration this will become a simple Cmp/Bool/CMove set to clone-up.
96 Node *bol, *cmov;
97 if( !(n->outcnt() == 1 && n->unique_out()->is_Bool() &&
200 for( uint j = 1; j < blk1->req(); j++ ) {
201 Node *x = n->clone();
202 // Widen the type of the ConvI2L when pushing up.
203 if (rtype != NULL) x->as_Type()->set_type(rtype);
204 if( n->in(0) && n->in(0) == blk1 )
205 x->set_req( 0, blk1->in(j) );
206 for( uint i = 1; i < n->req(); i++ ) {
207 Node *m = n->in(i);
208 if( get_ctrl(m) == blk1 ) {
209 assert( m->in(0) == blk1, "" );
210 x->set_req( i, m->in(j) );
211 }
212 }
213 register_new_node( x, blk1->in(j) );
214 phi->init_req( j, x );
215 }
216 // Announce phi to optimizer
217 register_new_node(phi, blk1);
218
219 // Remove cloned-up value from optimizer; use phi instead
220 split_mem_thru_phi(n, blk1, phi);
221 _igvn.replace_node( n, phi );
222
223 // (There used to be a self-recursive call to split_up() here,
224 // but it is not needed. All necessary forward walking is done
225 // by do_split_if() below.)
226
227 return true;
228 }
229
230 //------------------------------register_new_node------------------------------
231 void PhaseIdealLoop::register_new_node( Node *n, Node *blk ) {
232 assert(!n->is_CFG(), "must be data node");
233 _igvn.register_new_node_with_optimizer(n);
234 set_ctrl(n, blk);
235 IdealLoopTree *loop = get_loop(blk);
236 if( !loop->_child )
237 loop->_body.push(n);
238 }
239
240 //------------------------------small_cache------------------------------------
|