< prev index next >

src/share/vm/opto/loopnode.cpp

Print this page

        

*** 71,81 **** CountedLoopEndNode* le = l->loopexit(); if (le != NULL && le->proj_out(1 /* true */) == l->in(LoopNode::LoopBackControl)) { Node* phi = l->phi(); Node* exit = le->proj_out(0 /* false */); ! if (exit != NULL && exit->Opcode() == Op_IfFalse && phi != NULL && phi->is_Phi() && phi->in(LoopNode::LoopBackControl) == l->incr() && le->loopnode() == l && le->stride_is_con()) { return true; } --- 71,81 ---- CountedLoopEndNode* le = l->loopexit(); if (le != NULL && le->proj_out(1 /* true */) == l->in(LoopNode::LoopBackControl)) { Node* phi = l->phi(); Node* exit = le->proj_out(0 /* false */); ! if (exit != NULL && exit->Opcode() == Opcodes::Op_IfFalse && phi != NULL && phi->is_Phi() && phi->in(LoopNode::LoopBackControl) == l->incr() && le->loopnode() == l && le->stride_is_con()) { return true; }
*** 277,294 **** // Must also check for TOP when looking for a dead loop if (init_control->is_top() || back_control->is_top()) return false; // Allow funny placement of Safepoint ! if (back_control->Opcode() == Op_SafePoint) back_control = back_control->in(TypeFunc::Control); // Controlling test for loop Node *iftrue = back_control; ! uint iftrue_op = iftrue->Opcode(); ! if (iftrue_op != Op_IfTrue && ! iftrue_op != Op_IfFalse) // I have a weird back-control. Probably the loop-exit test is in // the middle of the loop and I am looking at some trailing control-flow // merge point. To fix this I would have to partially peel the loop. return false; // Obscure back-control --- 277,294 ---- // Must also check for TOP when looking for a dead loop if (init_control->is_top() || back_control->is_top()) return false; // Allow funny placement of Safepoint ! if (back_control->Opcode() == Opcodes::Op_SafePoint) back_control = back_control->in(TypeFunc::Control); // Controlling test for loop Node *iftrue = back_control; ! Opcodes iftrue_op = iftrue->Opcode(); ! if (iftrue_op != Opcodes::Op_IfTrue && ! iftrue_op != Opcodes::Op_IfFalse) // I have a weird back-control. Probably the loop-exit test is in // the middle of the loop and I am looking at some trailing control-flow // merge point. To fix this I would have to partially peel the loop. return false; // Obscure back-control
*** 297,314 **** if (get_loop(iff) != loop || !iff->in(1)->is_Bool()) return false; BoolNode *test = iff->in(1)->as_Bool(); BoolTest::mask bt = test->_test._test; float cl_prob = iff->as_If()->_prob; ! if (iftrue_op == Op_IfFalse) { bt = BoolTest(bt).negate(); cl_prob = 1.0 - cl_prob; } // Get backedge compare Node *cmp = test->in(1); ! int cmp_op = cmp->Opcode(); ! if (cmp_op != Op_CmpI) return false; // Avoid pointer & float compares // Find the trip-counter increment & limit. Limit must be loop invariant. Node *incr = cmp->in(1); Node *limit = cmp->in(2); --- 297,314 ---- if (get_loop(iff) != loop || !iff->in(1)->is_Bool()) return false; BoolNode *test = iff->in(1)->as_Bool(); BoolTest::mask bt = test->_test._test; float cl_prob = iff->as_If()->_prob; ! if (iftrue_op == Opcodes::Op_IfFalse) { bt = BoolTest(bt).negate(); cl_prob = 1.0 - cl_prob; } // Get backedge compare Node *cmp = test->in(1); ! Opcodes cmp_op = cmp->Opcode(); ! if (cmp_op != Opcodes::Op_CmpI) return false; // Avoid pointer & float compares // Find the trip-counter increment & limit. Limit must be loop invariant. Node *incr = cmp->in(1); Node *limit = cmp->in(2);
*** 328,338 **** if (!is_member(loop, get_ctrl(incr))) // Trip counter must be loop-variant return false; Node* phi_incr = NULL; // Trip-counter increment must be commutative & associative. ! if (incr->Opcode() == Op_CastII) { incr = incr->in(1); } if (incr->is_Phi()) { if (incr->as_Phi()->region() != x || incr->req() != 3) return false; // Not simple trip counter expression --- 328,338 ---- if (!is_member(loop, get_ctrl(incr))) // Trip counter must be loop-variant return false; Node* phi_incr = NULL; // Trip-counter increment must be commutative & associative. ! if (incr->Opcode() == Opcodes::Op_CastII) { incr = incr->in(1); } if (incr->is_Phi()) { if (incr->as_Phi()->region() != x || incr->req() != 3) return false; // Not simple trip counter expression
*** 346,356 **** Node* trunc2 = NULL; const TypeInt* iv_trunc_t = NULL; if (!(incr = CountedLoopNode::match_incr_with_optional_truncation(incr, &trunc1, &trunc2, &iv_trunc_t))) { return false; // Funny increment opcode } ! assert(incr->Opcode() == Op_AddI, "wrong increment code"); // Get merge point Node *xphi = incr->in(1); Node *stride = incr->in(2); if (!stride->is_Con()) { // Oops, swap these --- 346,356 ---- Node* trunc2 = NULL; const TypeInt* iv_trunc_t = NULL; if (!(incr = CountedLoopNode::match_incr_with_optional_truncation(incr, &trunc1, &trunc2, &iv_trunc_t))) { return false; // Funny increment opcode } ! assert(incr->Opcode() == Opcodes::Op_AddI, "wrong increment code"); // Get merge point Node *xphi = incr->in(1); Node *stride = incr->in(2); if (!stride->is_Con()) { // Oops, swap these
*** 358,368 **** return false; // Nope, unknown stride, bail out Node *tmp = xphi; // 'incr' is commutative, so ok to swap xphi = stride; stride = tmp; } ! if (xphi->Opcode() == Op_CastII) { xphi = xphi->in(1); } // Stride must be constant int stride_con = stride->get_int(); if (stride_con == 0) --- 358,368 ---- return false; // Nope, unknown stride, bail out Node *tmp = xphi; // 'incr' is commutative, so ok to swap xphi = stride; stride = tmp; } ! if (xphi->Opcode() == Opcodes::Op_CastII) { xphi = xphi->in(1); } // Stride must be constant int stride_con = stride->get_int(); if (stride_con == 0)
*** 457,467 **** } // ================================================= // ---- SUCCESS! Found A Trip-Counted Loop! ----- // ! assert(x->Opcode() == Op_Loop, "regular loops only"); C->print_method(PHASE_BEFORE_CLOOPS, 3); Node *hook = new Node(6); // =================================================== --- 457,467 ---- } // ================================================= // ---- SUCCESS! Found A Trip-Counted Loop! ----- // ! assert(x->Opcode() == Opcodes::Op_Loop, "regular loops only"); C->print_method(PHASE_BEFORE_CLOOPS, 3); Node *hook = new Node(6); // ===================================================
*** 533,544 **** bol = _igvn.register_new_node_with_optimizer(bol); set_subtree_ctrl(bol); // Replace condition in original predicate but preserve Opaque node // so that previous predicates could be found. ! assert(check_iff->in(1)->Opcode() == Op_Conv2B && ! check_iff->in(1)->in(1)->Opcode() == Op_Opaque1, ""); Node* opq = check_iff->in(1)->in(1); _igvn.replace_input_of(opq, 1, bol); // Update ctrl. set_ctrl(opq, check_iff->in(0)); set_ctrl(check_iff->in(1), check_iff->in(0)); --- 533,544 ---- bol = _igvn.register_new_node_with_optimizer(bol); set_subtree_ctrl(bol); // Replace condition in original predicate but preserve Opaque node // so that previous predicates could be found. ! assert(check_iff->in(1)->Opcode() == Opcodes::Op_Conv2B && ! check_iff->in(1)->in(1)->Opcode() == Opcodes::Op_Opaque1, ""); Node* opq = check_iff->in(1)->in(1); _igvn.replace_input_of(opq, 1, bol); // Update ctrl. set_ctrl(opq, check_iff->in(0)); set_ctrl(check_iff->in(1), check_iff->in(0));
*** 593,603 **** set_subtree_ctrl( limit ); if (!UseCountedLoopSafepoints) { // Check for SafePoint on backedge and remove Node *sfpt = x->in(LoopNode::LoopBackControl); ! if (sfpt->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt)) { lazy_replace( sfpt, iftrue ); if (loop->_safepts != NULL) { loop->_safepts->yank(sfpt); } loop->_tail = iftrue; --- 593,603 ---- set_subtree_ctrl( limit ); if (!UseCountedLoopSafepoints) { // Check for SafePoint on backedge and remove Node *sfpt = x->in(LoopNode::LoopBackControl); ! if (sfpt->Opcode() == Opcodes::Op_SafePoint && is_deleteable_safept(sfpt)) { lazy_replace( sfpt, iftrue ); if (loop->_safepts != NULL) { loop->_safepts->yank(sfpt); } loop->_tail = iftrue;
*** 643,656 **** uint dd = dom_depth(iff); set_idom(le, le->in(0), dd); // Update dominance for loop exit set_loop(le, loop); // Get the loop-exit control ! Node *iffalse = iff->as_If()->proj_out(!(iftrue_op == Op_IfTrue)); // Need to swap loop-exit and loop-back control? ! if (iftrue_op == Op_IfFalse) { Node *ift2=_igvn.register_new_node_with_optimizer(new IfTrueNode (le)); Node *iff2=_igvn.register_new_node_with_optimizer(new IfFalseNode(le)); loop->_tail = back_control = ift2; set_loop(ift2, loop); --- 643,656 ---- uint dd = dom_depth(iff); set_idom(le, le->in(0), dd); // Update dominance for loop exit set_loop(le, loop); // Get the loop-exit control ! Node *iffalse = iff->as_If()->proj_out(!(iftrue_op == Opcodes::Op_IfTrue)); // Need to swap loop-exit and loop-back control? ! if (iftrue_op == Opcodes::Op_IfFalse) { Node *ift2=_igvn.register_new_node_with_optimizer(new IfTrueNode (le)); Node *iff2=_igvn.register_new_node_with_optimizer(new IfFalseNode(le)); loop->_tail = back_control = ift2; set_loop(ift2, loop);
*** 691,701 **** set_idom(l, init_control, dom_depth(x)); if (!UseCountedLoopSafepoints) { // Check for immediately preceding SafePoint and remove Node *sfpt2 = le->in(0); ! if (sfpt2->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt2)) { lazy_replace( sfpt2, sfpt2->in(TypeFunc::Control)); if (loop->_safepts != NULL) { loop->_safepts->yank(sfpt2); } } --- 691,701 ---- set_idom(l, init_control, dom_depth(x)); if (!UseCountedLoopSafepoints) { // Check for immediately preceding SafePoint and remove Node *sfpt2 = le->in(0); ! if (sfpt2->Opcode() == Opcodes::Op_SafePoint && is_deleteable_safept(sfpt2)) { lazy_replace( sfpt2, sfpt2->in(TypeFunc::Control)); if (loop->_safepts != NULL) { loop->_safepts->yank(sfpt2); } }
*** 730,740 **** assert(loop->_head->is_CountedLoop(), ""); CountedLoopNode *cl = loop->_head->as_CountedLoop(); assert(cl->is_valid_counted_loop(), ""); if (ABS(cl->stride_con()) == 1 || ! cl->limit()->Opcode() == Op_LoopLimit) { // Old code has exact limit (it could be incorrect in case of int overflow). // Loop limit is exact with stride == 1. And loop may already have exact limit. return cl->limit(); } Node *limit = NULL; --- 730,740 ---- assert(loop->_head->is_CountedLoop(), ""); CountedLoopNode *cl = loop->_head->as_CountedLoop(); assert(cl->is_valid_counted_loop(), ""); if (ABS(cl->stride_con()) == 1 || ! cl->limit()->Opcode() == Opcodes::Op_LoopLimit) { // Old code has exact limit (it could be incorrect in case of int overflow). // Loop limit is exact with stride == 1. And loop may already have exact limit. return cl->limit(); } Node *limit = NULL;
*** 880,890 **** Node *span = phase->transform(new MulINode(trip, in(Stride))); return new AddINode(span, in(Init)); // exact limit } if (is_power_of_2(stride_p) || // divisor is 2^n ! !Matcher::has_match_rule(Op_LoopLimit)) { // or no specialized Mach node? // Convert to long expression to avoid integer overflow // and let igvn optimizer convert this division. // Node* init = phase->transform( new ConvI2LNode(in(Init))); Node* limit = phase->transform( new ConvI2LNode(in(Limit))); --- 880,890 ---- Node *span = phase->transform(new MulINode(trip, in(Stride))); return new AddINode(span, in(Init)); // exact limit } if (is_power_of_2(stride_p) || // divisor is 2^n ! !Matcher::has_match_rule(Opcodes::Op_LoopLimit)) { // or no specialized Mach node? // Convert to long expression to avoid integer overflow // and let igvn optimizer convert this division. // Node* init = phase->transform( new ConvI2LNode(in(Init))); Node* limit = phase->transform( new ConvI2LNode(in(Limit)));
*** 937,960 **** Node *t1 = NULL; Node *t2 = NULL; const TypeInt* trunc_t = TypeInt::INT; Node* n1 = expr; ! int n1op = n1->Opcode(); // Try to strip (n1 & M) or (n1 << N >> N) from n1. ! if (n1op == Op_AndI && n1->in(2)->is_Con() && n1->in(2)->bottom_type()->is_int()->get_con() == 0x7fff) { // %%% This check should match any mask of 2**K-1. t1 = n1; n1 = t1->in(1); n1op = n1->Opcode(); trunc_t = TypeInt::CHAR; ! } else if (n1op == Op_RShiftI && n1->in(1) != NULL && ! n1->in(1)->Opcode() == Op_LShiftI && n1->in(2) == n1->in(1)->in(2) && n1->in(2)->is_Con()) { jint shift = n1->in(2)->bottom_type()->is_int()->get_con(); // %%% This check should match any shift in [1..31]. if (shift == 16 || shift == 8) { --- 937,960 ---- Node *t1 = NULL; Node *t2 = NULL; const TypeInt* trunc_t = TypeInt::INT; Node* n1 = expr; ! Opcodes n1op = n1->Opcode(); // Try to strip (n1 & M) or (n1 << N >> N) from n1. ! if (n1op == Opcodes::Op_AndI && n1->in(2)->is_Con() && n1->in(2)->bottom_type()->is_int()->get_con() == 0x7fff) { // %%% This check should match any mask of 2**K-1. t1 = n1; n1 = t1->in(1); n1op = n1->Opcode(); trunc_t = TypeInt::CHAR; ! } else if (n1op == Opcodes::Op_RShiftI && n1->in(1) != NULL && ! n1->in(1)->Opcode() == Opcodes::Op_LShiftI && n1->in(2) == n1->in(1)->in(2) && n1->in(2)->is_Con()) { jint shift = n1->in(2)->bottom_type()->is_int()->get_con(); // %%% This check should match any shift in [1..31]. if (shift == 16 || shift == 8) {
*** 969,979 **** } } } // If (maybe after stripping) it is an AddI, we won: ! if (n1op == Op_AddI) { *trunc1 = t1; *trunc2 = t2; *trunc_type = trunc_t; return n1; } --- 969,979 ---- } } } // If (maybe after stripping) it is an AddI, we won: ! if (n1op == Opcodes::Op_AddI) { *trunc1 = t1; *trunc2 = t2; *trunc_type = trunc_t; return n1; }
*** 1046,1056 **** Node* val_ctrl = get_ctrl(val); uint val_dom_depth = dom_depth(val_ctrl); Node* pred = use_ctrl; uint if_cnt = 0; while (if_cnt < if_limit) { ! if ((pred->Opcode() == Op_IfTrue || pred->Opcode() == Op_IfFalse)) { if_cnt++; const TypeInt* if_t = IfNode::filtered_int_type(&_igvn, val, pred); if (if_t != NULL) { if (rtn_t == NULL) { rtn_t = if_t; --- 1046,1056 ---- Node* val_ctrl = get_ctrl(val); uint val_dom_depth = dom_depth(val_ctrl); Node* pred = use_ctrl; uint if_cnt = 0; while (if_cnt < if_limit) { ! if ((pred->Opcode() == Opcodes::Op_IfTrue || pred->Opcode() == Opcodes::Op_IfFalse)) { if_cnt++; const TypeInt* if_t = IfNode::filtered_int_type(&_igvn, val, pred); if (if_t != NULL) { if (rtn_t == NULL) { rtn_t = if_t;
*** 1241,1256 **** //------------------------------estimate_path_freq----------------------------- static float estimate_path_freq( Node *n ) { // Try to extract some path frequency info IfNode *iff; for( int i = 0; i < 50; i++ ) { // Skip through a bunch of uncommon tests ! uint nop = n->Opcode(); ! if( nop == Op_SafePoint ) { // Skip any safepoint n = n->in(0); continue; } ! if( nop == Op_CatchProj ) { // Get count from a prior call // Assume call does not always throw exceptions: means the call-site // count is also the frequency of the fall-through path. assert( n->is_CatchProj(), "" ); if( ((CatchProjNode*)n)->_con != CatchProjNode::fall_through_index ) return 0.0f; // Assume call exception path is rare --- 1241,1256 ---- //------------------------------estimate_path_freq----------------------------- static float estimate_path_freq( Node *n ) { // Try to extract some path frequency info IfNode *iff; for( int i = 0; i < 50; i++ ) { // Skip through a bunch of uncommon tests ! Opcodes nop = n->Opcode(); ! if( nop == Opcodes::Op_SafePoint ) { // Skip any safepoint n = n->in(0); continue; } ! if( nop == Opcodes::Op_CatchProj ) { // Get count from a prior call // Assume call does not always throw exceptions: means the call-site // count is also the frequency of the fall-through path. assert( n->is_CatchProj(), "" ); if( ((CatchProjNode*)n)->_con != CatchProjNode::fall_through_index ) return 0.0f; // Assume call exception path is rare
*** 1271,1284 **** Node *n_c = n->in(0); if( !n_c->is_If() ) break; // No estimate available iff = n_c->as_If(); if( iff->_fcnt != COUNT_UNKNOWN ) // Have a valid count? // Compute how much count comes on this path ! return ((nop == Op_IfTrue) ? iff->_prob : 1.0f - iff->_prob) * iff->_fcnt; // Have no count info. Skip dull uncommon-trap like branches. ! if( (nop == Op_IfTrue && iff->_prob < PROB_LIKELY_MAG(5)) || ! (nop == Op_IfFalse && iff->_prob > PROB_UNLIKELY_MAG(5)) ) break; // Skip through never-taken branch; look for a real loop exit. n = iff->in(0); } return 0.0f; // No estimate available --- 1271,1284 ---- Node *n_c = n->in(0); if( !n_c->is_If() ) break; // No estimate available iff = n_c->as_If(); if( iff->_fcnt != COUNT_UNKNOWN ) // Have a valid count? // Compute how much count comes on this path ! return ((nop == Opcodes::Op_IfTrue) ? iff->_prob : 1.0f - iff->_prob) * iff->_fcnt; // Have no count info. Skip dull uncommon-trap like branches. ! if( (nop == Opcodes::Op_IfTrue && iff->_prob < PROB_LIKELY_MAG(5)) || ! (nop == Opcodes::Op_IfFalse && iff->_prob > PROB_UNLIKELY_MAG(5)) ) break; // Skip through never-taken branch; look for a real loop exit. n = iff->in(0); } return 0.0f; // No estimate available
*** 1484,1494 **** visited.set(_tail->_idx); while (stack.size() > 0) { Node* n = stack.pop(); if (n->is_Call() && n->as_Call()->guaranteed_safepoint()) { // Terminate this path ! } else if (n->Opcode() == Op_SafePoint) { if (_phase->get_loop(n) != this) { if (_required_safept == NULL) _required_safept = new Node_List(); _required_safept->push(n); // save the one closest to the tail } // Terminate this path --- 1484,1494 ---- visited.set(_tail->_idx); while (stack.size() > 0) { Node* n = stack.pop(); if (n->is_Call() && n->as_Call()->guaranteed_safepoint()) { // Terminate this path ! } else if (n->Opcode() == Opcodes::Op_SafePoint) { if (_phase->get_loop(n) != this) { if (_required_safept == NULL) _required_safept = new Node_List(); _required_safept->push(n); // save the one closest to the tail } // Terminate this path
*** 1574,1584 **** for (Node* n = tail(); n != _head; n = _phase->idom(n)) { if (n->is_Call() && n->as_Call()->guaranteed_safepoint()) { has_call = true; _has_sfpt = 1; // Then no need for a safept! break; ! } else if (n->Opcode() == Op_SafePoint) { if (_phase->get_loop(n) == this) { has_local_ncsfpt = true; break; } if (nonlocal_ncsfpt == NULL) { --- 1574,1584 ---- for (Node* n = tail(); n != _head; n = _phase->idom(n)) { if (n->is_Call() && n->as_Call()->guaranteed_safepoint()) { has_call = true; _has_sfpt = 1; // Then no need for a safept! break; ! } else if (n->Opcode() == Opcodes::Op_SafePoint) { if (_phase->get_loop(n) == this) { has_local_ncsfpt = true; break; } if (nonlocal_ncsfpt == NULL) {
*** 1623,1633 **** } //---------------------------is_deleteable_safept---------------------------- // Is safept not required by an outer loop? bool PhaseIdealLoop::is_deleteable_safept(Node* sfpt) { ! assert(sfpt->Opcode() == Op_SafePoint, ""); IdealLoopTree* lp = get_loop(sfpt)->_parent; while (lp != NULL) { Node_List* sfpts = lp->_required_safept; if (sfpts != NULL) { for (uint i = 0; i < sfpts->size(); i++) { --- 1623,1633 ---- } //---------------------------is_deleteable_safept---------------------------- // Is safept not required by an outer loop? bool PhaseIdealLoop::is_deleteable_safept(Node* sfpt) { ! assert(sfpt->Opcode() == Opcodes::Op_SafePoint, ""); IdealLoopTree* lp = get_loop(sfpt)->_parent; while (lp != NULL) { Node_List* sfpts = lp->_required_safept; if (sfpts != NULL) { for (uint i = 0; i < sfpts->size(); i++) {
*** 1665,1675 **** // Look for induction variables of the form: X += constant if (phi2->region() != loop->_head || incr2->req() != 3 || incr2->in(1) != phi2 || incr2 == incr || ! incr2->Opcode() != Op_AddI || !incr2->in(2)->is_Con()) continue; // Check for parallel induction variable (parallel to trip counter) // via an affine function. In particular, count-down loops with --- 1665,1675 ---- // Look for induction variables of the form: X += constant if (phi2->region() != loop->_head || incr2->req() != 3 || incr2->in(1) != phi2 || incr2 == incr || ! incr2->Opcode() != Opcodes::Op_AddI || !incr2->in(2)->is_Con()) continue; // Check for parallel induction variable (parallel to trip counter) // via an affine function. In particular, count-down loops with
*** 1727,1737 **** void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) { Node* keep = NULL; if (keep_one) { // Look for a safepoint on the idom-path. for (Node* i = tail(); i != _head; i = phase->idom(i)) { ! if (i->Opcode() == Op_SafePoint && phase->get_loop(i) == this) { keep = i; break; // Found one } } } --- 1727,1737 ---- void IdealLoopTree::remove_safepoints(PhaseIdealLoop* phase, bool keep_one) { Node* keep = NULL; if (keep_one) { // Look for a safepoint on the idom-path. for (Node* i = tail(); i != _head; i = phase->idom(i)) { ! if (i->Opcode() == Opcodes::Op_SafePoint && phase->get_loop(i) == this) { keep = i; break; // Found one } } }
*** 1742,1752 **** bool prune = !keep_one || keep != NULL; // Delete other safepoints in this loop. Node_List* sfpts = _safepts; if (prune && sfpts != NULL) { ! assert(keep == NULL || keep->Opcode() == Op_SafePoint, "not safepoint"); for (uint i = 0; i < sfpts->size(); i++) { Node* n = sfpts->at(i); assert(phase->get_loop(n) == this, ""); if (n != keep && phase->is_deleteable_safept(n)) { phase->lazy_replace(n, n->in(TypeFunc::Control)); --- 1742,1752 ---- bool prune = !keep_one || keep != NULL; // Delete other safepoints in this loop. Node_List* sfpts = _safepts; if (prune && sfpts != NULL) { ! assert(keep == NULL || keep->Opcode() == Opcodes::Op_SafePoint, "not safepoint"); for (uint i = 0; i < sfpts->size(); i++) { Node* n = sfpts->at(i); assert(phase->get_loop(n) == this, ""); if (n != keep && phase->is_deleteable_safept(n)) { phase->lazy_replace(n, n->in(TypeFunc::Control));
*** 1905,1915 **** !loop->tail()->is_top()) { LoopNode* lpn = loop->_head->as_Loop(); Node* entry = lpn->in(LoopNode::EntryControl); Node* predicate_proj = find_predicate(entry); // loop_limit_check first if (predicate_proj != NULL ) { // right pattern that can be used by loop predication ! assert(entry->in(0)->in(1)->in(1)->Opcode() == Op_Opaque1, "must be"); useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one entry = entry->in(0)->in(0); } predicate_proj = find_predicate(entry); // Predicate if (predicate_proj != NULL ) { --- 1905,1915 ---- !loop->tail()->is_top()) { LoopNode* lpn = loop->_head->as_Loop(); Node* entry = lpn->in(LoopNode::EntryControl); Node* predicate_proj = find_predicate(entry); // loop_limit_check first if (predicate_proj != NULL ) { // right pattern that can be used by loop predication ! assert(entry->in(0)->in(1)->in(1)->Opcode() == Opcodes::Op_Opaque1, "must be"); useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one entry = entry->in(0)->in(0); } predicate_proj = find_predicate(entry); // Predicate if (predicate_proj != NULL ) {
*** 1935,1945 **** collect_potentially_useful_predicates(_ltree_root->_child, useful_predicates); } for (int i = C->predicate_count(); i > 0; i--) { Node * n = C->predicate_opaque1_node(i-1); ! assert(n->Opcode() == Op_Opaque1, "must be"); if (!useful_predicates.member(n)) { // not in the useful list _igvn.replace_node(n, n->in(1)); } } } --- 1935,1945 ---- collect_potentially_useful_predicates(_ltree_root->_child, useful_predicates); } for (int i = C->predicate_count(); i > 0; i--) { Node * n = C->predicate_opaque1_node(i-1); ! assert(n->Opcode() == Opcodes::Op_Opaque1, "must be"); if (!useful_predicates.member(n)) { // not in the useful list _igvn.replace_node(n, n->in(1)); } } }
*** 2553,2579 **** // Counted loops that are guarded should be able to find their guards if( _head->is_CountedLoop() && _head->as_CountedLoop()->is_main_loop() ) { CountedLoopNode *cl = _head->as_CountedLoop(); Node *init = cl->init_trip(); Node *ctrl = cl->in(LoopNode::EntryControl); ! assert( ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "" ); Node *iff = ctrl->in(0); ! assert( iff->Opcode() == Op_If, "" ); Node *bol = iff->in(1); ! assert( bol->Opcode() == Op_Bool, "" ); Node *cmp = bol->in(1); ! assert( cmp->Opcode() == Op_CmpI, "" ); Node *add = cmp->in(1); Node *opaq; ! if( add->Opcode() == Op_Opaque1 ) { opaq = add; } else { ! assert( add->Opcode() == Op_AddI || add->Opcode() == Op_ConI , "" ); assert( add == init, "" ); opaq = cmp->in(2); } ! assert( opaq->Opcode() == Op_Opaque1, "" ); } if (_child != NULL) _child->verify_tree(loop->_child, this); if (_next != NULL) _next ->verify_tree(loop->_next, parent); --- 2553,2579 ---- // Counted loops that are guarded should be able to find their guards if( _head->is_CountedLoop() && _head->as_CountedLoop()->is_main_loop() ) { CountedLoopNode *cl = _head->as_CountedLoop(); Node *init = cl->init_trip(); Node *ctrl = cl->in(LoopNode::EntryControl); ! assert( ctrl->Opcode() == Opcodes::Op_IfTrue || ctrl->Opcode() == Opcodes::Op_IfFalse, "" ); Node *iff = ctrl->in(0); ! assert( iff->Opcode() == Opcodes::Op_If, "" ); Node *bol = iff->in(1); ! assert( bol->Opcode() == Opcodes::Op_Bool, "" ); Node *cmp = bol->in(1); ! assert( cmp->Opcode() == Opcodes::Op_CmpI, "" ); Node *add = cmp->in(1); Node *opaq; ! if( add->Opcode() == Opcodes::Op_Opaque1 ) { opaq = add; } else { ! assert( add->Opcode() == Opcodes::Op_AddI || add->Opcode() == Opcodes::Op_ConI , "" ); assert( add == init, "" ); opaq = cmp->in(2); } ! assert( opaq->Opcode() == Opcodes::Op_Opaque1, "" ); } if (_child != NULL) _child->verify_tree(loop->_child, this); if (_next != NULL) _next ->verify_tree(loop->_next, parent);
*** 2963,2984 **** // Do not count uncommon calls if( !n->is_CallStaticJava() || !n->as_CallStaticJava()->_name ) { Node *iff = n->in(0)->in(0); // No any calls for vectorized loops. if( UseSuperWord || !iff->is_If() || ! (n->in(0)->Opcode() == Op_IfFalse && (1.0 - iff->as_If()->_prob) >= 0.01) || (iff->as_If()->_prob >= 0.01) ) innermost->_has_call = 1; } } else if( n->is_Allocate() && n->as_Allocate()->_is_scalar_replaceable ) { // Disable loop optimizations if the loop has a scalar replaceable // allocation. This disabling may cause a potential performance lost // if the allocation is not eliminated for some reason. innermost->_allow_optimizations = false; innermost->_has_call = 1; // = true ! } else if (n->Opcode() == Op_SafePoint) { // Record all safepoints in this loop. if (innermost->_safepts == NULL) innermost->_safepts = new Node_List(); innermost->_safepts->push(n); } } --- 2963,2984 ---- // Do not count uncommon calls if( !n->is_CallStaticJava() || !n->as_CallStaticJava()->_name ) { Node *iff = n->in(0)->in(0); // No any calls for vectorized loops. if( UseSuperWord || !iff->is_If() || ! (n->in(0)->Opcode() == Opcodes::Op_IfFalse && (1.0 - iff->as_If()->_prob) >= 0.01) || (iff->as_If()->_prob >= 0.01) ) innermost->_has_call = 1; } } else if( n->is_Allocate() && n->as_Allocate()->_is_scalar_replaceable ) { // Disable loop optimizations if the loop has a scalar replaceable // allocation. This disabling may cause a potential performance lost // if the allocation is not eliminated for some reason. innermost->_allow_optimizations = false; innermost->_has_call = 1; // = true ! } else if (n->Opcode() == Opcodes::Op_SafePoint) { // Record all safepoints in this loop. if (innermost->_safepts == NULL) innermost->_safepts = new Node_List(); innermost->_safepts->push(n); } }
*** 3024,3034 **** } // Remove safepoints ONLY if I've already seen I don't need one. // (the old code here would yank a 2nd safepoint after seeing a // first one, even though the 1st did not dominate in the loop body // and thus could be avoided indefinitely) ! if( !_verify_only && !_verify_me && ilt->_has_sfpt && n->Opcode() == Op_SafePoint && is_deleteable_safept(n)) { Node *in = n->in(TypeFunc::Control); lazy_replace(n,in); // Pull safepoint now if (ilt->_safepts != NULL) { ilt->_safepts->yank(n); --- 3024,3034 ---- } // Remove safepoints ONLY if I've already seen I don't need one. // (the old code here would yank a 2nd safepoint after seeing a // first one, even though the 1st did not dominate in the loop body // and thus could be avoided indefinitely) ! if( !_verify_only && !_verify_me && ilt->_has_sfpt && n->Opcode() == Opcodes::Op_SafePoint && is_deleteable_safept(n)) { Node *in = n->in(TypeFunc::Control); lazy_replace(n,in); // Pull safepoint now if (ilt->_safepts != NULL) { ilt->_safepts->yank(n);
*** 3233,3243 **** } // compares can get conditionally flipped bool found_opaque = false; for (uint i = 1; i < cmpzm->req(); i++) { Node* opnd = cmpzm->in(i); ! if (opnd && opnd->Opcode() == Op_Opaque1) { found_opaque = true; break; } } if (!found_opaque) { --- 3233,3243 ---- } // compares can get conditionally flipped bool found_opaque = false; for (uint i = 1; i < cmpzm->req(); i++) { Node* opnd = cmpzm->in(i); ! if (opnd && opnd->Opcode() == Opcodes::Op_Opaque1) { found_opaque = true; break; } } if (!found_opaque) {
*** 3457,3467 **** //------------------------------build_loop_late_post--------------------------- // Put Data nodes into some loop nest, by setting the _nodes[]->loop mapping. // Second pass finds latest legal placement, and ideal loop placement. void PhaseIdealLoop::build_loop_late_post( Node *n ) { ! if (n->req() == 2 && (n->Opcode() == Op_ConvI2L || n->Opcode() == Op_CastII) && !C->major_progress() && !_verify_only) { _igvn._worklist.push(n); // Maybe we'll normalize it, if no more loops. } #ifdef ASSERT if (_verify_only && !n->is_CFG()) { --- 3457,3467 ---- //------------------------------build_loop_late_post--------------------------- // Put Data nodes into some loop nest, by setting the _nodes[]->loop mapping. // Second pass finds latest legal placement, and ideal loop placement. void PhaseIdealLoop::build_loop_late_post( Node *n ) { ! if (n->req() == 2 && (n->Opcode() == Opcodes::Op_ConvI2L || n->Opcode() == Opcodes::Op_CastII) && !C->major_progress() && !_verify_only) { _igvn._worklist.push(n); // Maybe we'll normalize it, if no more loops. } #ifdef ASSERT if (_verify_only && !n->is_CFG()) {
*** 3478,3514 **** // _must_ be pinned (they have to observe their control edge of course). // Unlike Stores (which modify an unallocable resource, the memory // state), Mods/Loads can float around. So free them up. bool pinned = true; switch( n->Opcode() ) { ! case Op_DivI: ! case Op_DivF: ! case Op_DivD: ! case Op_ModI: ! case Op_ModF: ! case Op_ModD: ! case Op_LoadB: // Same with Loads; they can sink ! case Op_LoadUB: // during loop optimizations. ! case Op_LoadUS: ! case Op_LoadD: ! case Op_LoadF: ! case Op_LoadI: ! case Op_LoadKlass: ! case Op_LoadNKlass: ! case Op_LoadL: ! case Op_LoadS: ! case Op_LoadP: ! case Op_LoadN: ! case Op_LoadRange: ! case Op_LoadD_unaligned: ! case Op_LoadL_unaligned: ! case Op_StrComp: // Does a bunch of load-like effects ! case Op_StrEquals: ! case Op_StrIndexOf: ! case Op_StrIndexOfChar: ! case Op_AryEq: ! case Op_HasNegatives: pinned = false; } if( pinned ) { IdealLoopTree *chosen_loop = get_loop(n->is_CFG() ? n : get_ctrl(n)); if( !chosen_loop->_child ) // Inner loop? --- 3478,3514 ---- // _must_ be pinned (they have to observe their control edge of course). // Unlike Stores (which modify an unallocable resource, the memory // state), Mods/Loads can float around. So free them up. bool pinned = true; switch( n->Opcode() ) { ! case Opcodes::Op_DivI: ! case Opcodes::Op_DivF: ! case Opcodes::Op_DivD: ! case Opcodes::Op_ModI: ! case Opcodes::Op_ModF: ! case Opcodes::Op_ModD: ! case Opcodes::Op_LoadB: // Same with Loads; they can sink ! case Opcodes::Op_LoadUB: // during loop optimizations. ! case Opcodes::Op_LoadUS: ! case Opcodes::Op_LoadD: ! case Opcodes::Op_LoadF: ! case Opcodes::Op_LoadI: ! case Opcodes::Op_LoadKlass: ! case Opcodes::Op_LoadNKlass: ! case Opcodes::Op_LoadL: ! case Opcodes::Op_LoadS: ! case Opcodes::Op_LoadP: ! case Opcodes::Op_LoadN: ! case Opcodes::Op_LoadRange: ! case Opcodes::Op_LoadD_unaligned: ! case Opcodes::Op_LoadL_unaligned: ! case Opcodes::Op_StrComp: // Does a bunch of load-like effects ! case Opcodes::Op_StrEquals: ! case Opcodes::Op_StrIndexOf: ! case Opcodes::Op_StrIndexOfChar: ! case Opcodes::Op_AryEq: ! case Opcodes::Op_HasNegatives: pinned = false; } if( pinned ) { IdealLoopTree *chosen_loop = get_loop(n->is_CFG() ? n : get_ctrl(n)); if( !chosen_loop->_child ) // Inner loop?
< prev index next >