1.1 --- a/src/share/vm/opto/loopPredicate.cpp Thu Jul 28 13:03:39 2011 -0700 1.2 +++ b/src/share/vm/opto/loopPredicate.cpp Fri Jul 29 09:16:29 2011 -0700 1.3 @@ -327,81 +327,20 @@ 1.4 return new_predicate_proj; 1.5 } 1.6 1.7 -//--------------------------move_predicate----------------------- 1.8 -// Cut predicate from old place and move it to new. 1.9 -ProjNode* PhaseIdealLoop::move_predicate(ProjNode* predicate_proj, Node* new_entry, 1.10 - Deoptimization::DeoptReason reason, 1.11 - PhaseIdealLoop* loop_phase, 1.12 - PhaseIterGVN* igvn) { 1.13 - assert(new_entry != NULL, "must be"); 1.14 - assert(predicate_proj->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); 1.15 - IfNode* iff = predicate_proj->in(0)->as_If(); 1.16 - Node* old_entry = iff->in(0); 1.17 - 1.18 - // Cut predicate from old place. 1.19 - Node* old = predicate_proj; 1.20 - igvn->_worklist.push(old); 1.21 - for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin;) { 1.22 - Node* use = old->last_out(i); // for each use... 1.23 - igvn->hash_delete(use); 1.24 - igvn->_worklist.push(use); 1.25 - // Update use-def info 1.26 - uint uses_found = 0; 1.27 - for (uint j = 0; j < use->req(); j++) { 1.28 - if (use->in(j) == old) { 1.29 - use->set_req(j, old_entry); 1.30 - uses_found++; 1.31 - if (loop_phase != NULL) { 1.32 - if (use->is_CFG()) { 1.33 - // When called from beautify_loops() idom is not constructed yet. 1.34 - if (loop_phase->_idom != NULL) 1.35 - loop_phase->set_idom(use, old_entry, loop_phase->dom_depth(use)); 1.36 - } else { 1.37 - loop_phase->set_ctrl(use, old_entry); 1.38 - } 1.39 - } 1.40 - } 1.41 - } 1.42 - i -= uses_found; // we deleted 1 or more copies of this edge 1.43 - } 1.44 - 1.45 - // Move predicate. 1.46 - igvn->hash_delete(iff); 1.47 - iff->set_req(0, new_entry); 1.48 - igvn->_worklist.push(iff); 1.49 - 1.50 - if (loop_phase != NULL) { 1.51 - // Fix up idom and ctrl. 1.52 - loop_phase->set_ctrl(iff->in(1), new_entry); 1.53 - loop_phase->set_ctrl(iff->in(1)->in(1), new_entry); 1.54 - // When called from beautify_loops() idom is not constructed yet. 1.55 - if (loop_phase->_idom != NULL) 1.56 - loop_phase->set_idom(iff, new_entry, loop_phase->dom_depth(iff)); 1.57 - } 1.58 - 1.59 - return predicate_proj; 1.60 -} 1.61 1.62 //--------------------------clone_loop_predicates----------------------- 1.63 // Interface from IGVN 1.64 Node* PhaseIterGVN::clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 1.65 - return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, false, clone_limit_check, NULL, this); 1.66 -} 1.67 -Node* PhaseIterGVN::move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 1.68 - return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, true, clone_limit_check, NULL, this); 1.69 + return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, clone_limit_check, NULL, this); 1.70 } 1.71 1.72 // Interface from PhaseIdealLoop 1.73 Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 1.74 - return clone_loop_predicates(old_entry, new_entry, false, clone_limit_check, this, &this->_igvn); 1.75 -} 1.76 -Node* PhaseIdealLoop::move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 1.77 - return clone_loop_predicates(old_entry, new_entry, true, clone_limit_check, this, &this->_igvn); 1.78 + return clone_loop_predicates(old_entry, new_entry, clone_limit_check, this, &this->_igvn); 1.79 } 1.80 1.81 // Clone loop predicates to cloned loops (peeled, unswitched, split_if). 1.82 Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry, 1.83 - bool move_predicates, 1.84 bool clone_limit_check, 1.85 PhaseIdealLoop* loop_phase, 1.86 PhaseIterGVN* igvn) { 1.87 @@ -424,20 +363,13 @@ 1.88 if (UseLoopPredicate) { 1.89 ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 1.90 if (predicate_proj != NULL) { // right pattern that can be used by loop predication 1.91 - if (move_predicates) { 1.92 - new_entry = move_predicate(predicate_proj, new_entry, 1.93 - Deoptimization::Reason_predicate, 1.94 - loop_phase, igvn); 1.95 - assert(new_entry == predicate_proj, "old predicate fall through projection"); 1.96 - } else { 1.97 - // clone predicate 1.98 - new_entry = clone_predicate(predicate_proj, new_entry, 1.99 - Deoptimization::Reason_predicate, 1.100 - loop_phase, igvn); 1.101 - assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone predicate"); 1.102 - } 1.103 + // clone predicate 1.104 + new_entry = clone_predicate(predicate_proj, new_entry, 1.105 + Deoptimization::Reason_predicate, 1.106 + loop_phase, igvn); 1.107 + assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone predicate"); 1.108 if (TraceLoopPredicate) { 1.109 - tty->print_cr("Loop Predicate %s: ", move_predicates ? "moved" : "cloned"); 1.110 + tty->print("Loop Predicate cloned: "); 1.111 debug_only( new_entry->in(0)->dump(); ) 1.112 } 1.113 } 1.114 @@ -446,45 +378,18 @@ 1.115 // Clone loop limit check last to insert it before loop. 1.116 // Don't clone a limit check which was already finalized 1.117 // for this counted loop (only one limit check is needed). 1.118 - if (move_predicates) { 1.119 - new_entry = move_predicate(limit_check_proj, new_entry, 1.120 - Deoptimization::Reason_loop_limit_check, 1.121 - loop_phase, igvn); 1.122 - assert(new_entry == limit_check_proj, "old limit check fall through projection"); 1.123 - } else { 1.124 - new_entry = clone_predicate(limit_check_proj, new_entry, 1.125 - Deoptimization::Reason_loop_limit_check, 1.126 - loop_phase, igvn); 1.127 - assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone limit check"); 1.128 - } 1.129 + new_entry = clone_predicate(limit_check_proj, new_entry, 1.130 + Deoptimization::Reason_loop_limit_check, 1.131 + loop_phase, igvn); 1.132 + assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone limit check"); 1.133 if (TraceLoopLimitCheck) { 1.134 - tty->print_cr("Loop Limit Check %s: ", move_predicates ? "moved" : "cloned"); 1.135 + tty->print("Loop Limit Check cloned: "); 1.136 debug_only( new_entry->in(0)->dump(); ) 1.137 } 1.138 } 1.139 return new_entry; 1.140 } 1.141 1.142 -//--------------------------eliminate_loop_predicates----------------------- 1.143 -void PhaseIdealLoop::eliminate_loop_predicates(Node* entry) { 1.144 - if (LoopLimitCheck) { 1.145 - Node* predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 1.146 - if (predicate != NULL) { 1.147 - entry = entry->in(0)->in(0); 1.148 - } 1.149 - } 1.150 - if (UseLoopPredicate) { 1.151 - ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 1.152 - if (predicate_proj != NULL) { // right pattern that can be used by loop predication 1.153 - Node* n = entry->in(0)->in(1)->in(1); 1.154 - assert(n->Opcode()==Op_Opaque1, "must be"); 1.155 - // Remove Opaque1 node from predicates list. 1.156 - // IGVN will remove this predicate check. 1.157 - _igvn.replace_node(n, n->in(1)); 1.158 - } 1.159 - } 1.160 -} 1.161 - 1.162 //--------------------------skip_loop_predicates------------------------------ 1.163 // Skip related predicates. 1.164 Node* PhaseIdealLoop::skip_loop_predicates(Node* entry) {