264 bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { |
264 bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) { |
265 PhaseGVN *gvn = &_igvn; |
265 PhaseGVN *gvn = &_igvn; |
266 |
266 |
267 // Counted loop head must be a good RegionNode with only 3 not NULL |
267 // Counted loop head must be a good RegionNode with only 3 not NULL |
268 // control input edges: Self, Entry, LoopBack. |
268 // control input edges: Self, Entry, LoopBack. |
269 if (x->in(LoopNode::Self) == NULL || x->req() != 3) |
269 if (x->in(LoopNode::Self) == NULL || x->req() != 3 || loop->_irreducible) { |
270 return false; |
270 return false; |
271 |
271 } |
272 Node *init_control = x->in(LoopNode::EntryControl); |
272 Node *init_control = x->in(LoopNode::EntryControl); |
273 Node *back_control = x->in(LoopNode::LoopBackControl); |
273 Node *back_control = x->in(LoopNode::LoopBackControl); |
274 if (init_control == NULL || back_control == NULL) // Partially dead |
274 if (init_control == NULL || back_control == NULL) // Partially dead |
275 return false; |
275 return false; |
276 // Must also check for TOP when looking for a dead loop |
276 // Must also check for TOP when looking for a dead loop |
1520 result = true; |
1520 result = true; |
1521 } |
1521 } |
1522 |
1522 |
1523 // If I have one hot backedge, peel off myself loop. |
1523 // If I have one hot backedge, peel off myself loop. |
1524 // I better be the outermost loop. |
1524 // I better be the outermost loop. |
1525 if( _head->req() > 3 ) { |
1525 if (_head->req() > 3 && !_irreducible) { |
1526 split_outer_loop( phase ); |
1526 split_outer_loop( phase ); |
1527 result = true; |
1527 result = true; |
1528 |
1528 |
1529 } else if( !_head->is_Loop() && !_irreducible ) { |
1529 } else if (!_head->is_Loop() && !_irreducible) { |
1530 // Make a new LoopNode to replace the old loop head |
1530 // Make a new LoopNode to replace the old loop head |
1531 Node *l = new (phase->C) LoopNode( _head->in(1), _head->in(2) ); |
1531 Node *l = new (phase->C) LoopNode( _head->in(1), _head->in(2) ); |
1532 l = igvn.register_new_node_with_optimizer(l, _head); |
1532 l = igvn.register_new_node_with_optimizer(l, _head); |
1533 phase->set_created_loop_node(); |
1533 phase->set_created_loop_node(); |
1534 // Go ahead and replace _head |
1534 // Go ahead and replace _head |
2936 if (l == NULL) { |
2936 if (l == NULL) { |
2937 C->record_method_not_compilable("unhandled CFG detected during loop optimization"); |
2937 C->record_method_not_compilable("unhandled CFG detected during loop optimization"); |
2938 return pre_order; |
2938 return pre_order; |
2939 } |
2939 } |
2940 } |
2940 } |
|
2941 C->set_has_irreducible_loop(_has_irreducible_loops); |
2941 } |
2942 } |
2942 |
2943 |
2943 // This Node might be a decision point for loops. It is only if |
2944 // This Node might be a decision point for loops. It is only if |
2944 // it's children belong to several different loops. The sort call |
2945 // it's children belong to several different loops. The sort call |
2945 // does a trivial amount of work if there is only 1 child or all |
2946 // does a trivial amount of work if there is only 1 child or all |