//------------------------------policy_unswitching----------------------------- // Return TRUE or FALSE if the loop should be unswitched // (ie. clone loop with an invariant test that does not exit the loop) bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const { if( !LoopUnswitching ) { return false; } uint nodes_left = MaxNodeLimit - phase->C->unique(); if (2 * _body.size() > nodes_left) { return false; // Too speculative if running low on nodes. } LoopNode* head = _head->as_Loop(); if (head->unswitch_count() + 1 > head->unswitch_max()) { return false; } return phase->find_unswitching_candidate(this) != NULL; }
//------------------------------policy_unswitching----------------------------- // Return TRUE or FALSE if the loop should be unswitched // (ie. clone loop with an invariant test that does not exit the loop) bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const { if( !LoopUnswitching ) { return false; } if (!_head->is_Loop()) { return false; } // check for vectorized loops, any unswitching was already applied if (_head->is_CountedLoop() && _head->as_CountedLoop()->do_unroll_only()) { return false; } int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes(); if ((int)(2 * _body.size()) > nodes_left) { return false; // Too speculative if running low on nodes. } LoopNode* head = _head->as_Loop(); if (head->unswitch_count() + 1 > head->unswitch_max()) { return false; } return phase->find_unswitching_candidate(this) != NULL; }