hotspot/src/share/vm/opto/loopopts.cpp
changeset 9124 f60dee480d49
parent 8921 14bfe81f2a9d
parent 9101 ff58f9a8e31c
child 9330 b55150173fc9
equal deleted inserted replaced
9093:62b8e328f8c8 9124:f60dee480d49
  2137 // Step 4: update the dominator tree and recompute the
  2137 // Step 4: update the dominator tree and recompute the
  2138 //         dominator depth.
  2138 //         dominator depth.
  2139 //
  2139 //
  2140 //                   orig
  2140 //                   orig
  2141 //
  2141 //
  2142 //                  stmt1
  2142 //                   stmt1
  2143 //                    |
  2143 //                     |
  2144 //                    v
  2144 //                     v
       
  2145 //               loop predicate
       
  2146 //                     |
       
  2147 //                     v
  2145 //                   loop<----+
  2148 //                   loop<----+
  2146 //                     |      |
  2149 //                     |      |
  2147 //                   stmt2    |
  2150 //                   stmt2    |
  2148 //                     |      |
  2151 //                     |      |
  2149 //                     v      |
  2152 //                     v      |
  2170 //
  2173 //
  2171 //
  2174 //
  2172 //            after clone loop
  2175 //            after clone loop
  2173 //
  2176 //
  2174 //                   stmt1
  2177 //                   stmt1
       
  2178 //                     |
       
  2179 //                     v
       
  2180 //               loop predicate
  2175 //                 /       \
  2181 //                 /       \
  2176 //        clone   /         \   orig
  2182 //        clone   /         \   orig
  2177 //               /           \
  2183 //               /           \
  2178 //              /             \
  2184 //              /             \
  2179 //             v               v
  2185 //             v               v
  2208 //
  2214 //
  2209 //
  2215 //
  2210 //           after partial peel
  2216 //           after partial peel
  2211 //
  2217 //
  2212 //                  stmt1
  2218 //                  stmt1
       
  2219 //                     |
       
  2220 //                     v
       
  2221 //               loop predicate
  2213 //                 /
  2222 //                 /
  2214 //        clone   /             orig
  2223 //        clone   /             orig
  2215 //               /          TOP
  2224 //               /          TOP
  2216 //              /             \
  2225 //              /             \
  2217 //             v               v
  2226 //             v               v
  2218 //    TOP->region             region----+
  2227 //    TOP->loop                loop----+
  2219 //          |                    |      |
  2228 //          |                    |      |
  2220 //        stmt2                stmt2    |
  2229 //        stmt2                stmt2    |
  2221 //          |                    |      |
  2230 //          |                    |      |
  2222 //          v                    v      |
  2231 //          v                    v      |
  2223 //          ifA                 ifA     |
  2232 //          ifA                 ifA     |
  2251 //              final graph
  2260 //              final graph
  2252 //
  2261 //
  2253 //                  stmt1
  2262 //                  stmt1
  2254 //                    |
  2263 //                    |
  2255 //                    v
  2264 //                    v
       
  2265 //                  stmt2 clone
       
  2266 //                    |
       
  2267 //                    v
  2256 //         ........> ifA clone
  2268 //         ........> ifA clone
  2257 //         :        / |
  2269 //         :        / |
  2258 //        dom      /  |
  2270 //        dom      /  |
  2259 //         :      v   v
  2271 //         :      v   v
  2260 //         :  false   true
  2272 //         :  false   true
  2261 //         :  |       |
  2273 //         :  |       |
  2262 //         :  |     stmt2 clone
  2274 //         :  |       v
       
  2275 //         :  | loop predicate
  2263 //         :  |       |
  2276 //         :  |       |
  2264 //         :  |       v
  2277 //         :  |       v
  2265 //         :  |    newloop<-----+
  2278 //         :  |    newloop<-----+
  2266 //         :  |        |        |
  2279 //         :  |        |        |
  2267 //         :  |     stmt3 clone |
  2280 //         :  |     stmt3 clone |
  2287 //             v
  2300 //             v
  2288 //           exitA
  2301 //           exitA
  2289 //
  2302 //
  2290 bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
  2303 bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
  2291 
  2304 
       
  2305   assert(!loop->_head->is_CountedLoop(), "Non-counted loop only");
  2292   if (!loop->_head->is_Loop()) {
  2306   if (!loop->_head->is_Loop()) {
  2293     return false;  }
  2307     return false;  }
  2294 
  2308 
  2295   LoopNode *head  = loop->_head->as_Loop();
  2309   LoopNode *head  = loop->_head->as_Loop();
  2296 
  2310 
  2314 #endif
  2328 #endif
  2315       return false;
  2329       return false;
  2316     }
  2330     }
  2317   }
  2331   }
  2318 
  2332 
       
  2333   Node* entry = head->in(LoopNode::EntryControl);
  2319   int dd = dom_depth(head);
  2334   int dd = dom_depth(head);
  2320 
  2335 
  2321   // Step 1: find cut point
  2336   // Step 1: find cut point
  2322 
  2337 
  2323   // Walk up dominators to loop head looking for first loop exit
  2338   // Walk up dominators to loop head looking for first loop exit
  2610     }
  2625     }
  2611   }
  2626   }
  2612 
  2627 
  2613   // Backedge of the surviving new_head (the clone) is original last_peel
  2628   // Backedge of the surviving new_head (the clone) is original last_peel
  2614   _igvn.hash_delete(new_head_clone);
  2629   _igvn.hash_delete(new_head_clone);
       
  2630   Node* new_entry = move_loop_predicates(entry, new_head_clone->in(LoopNode::EntryControl));
       
  2631   new_head_clone->set_req(LoopNode::EntryControl, new_entry);
  2615   new_head_clone->set_req(LoopNode::LoopBackControl, last_peel);
  2632   new_head_clone->set_req(LoopNode::LoopBackControl, last_peel);
  2616   _igvn._worklist.push(new_head_clone);
  2633   _igvn._worklist.push(new_head_clone);
  2617 
  2634 
  2618   // Cut first node in original not_peel set
  2635   // Cut first node in original not_peel set
  2619   _igvn.hash_delete(new_head);
  2636   _igvn.hash_delete(new_head);