diff -r 07acc51c1d2a -r 08eb13460b3a src/share/vm/opto/loopopts.cpp --- a/src/share/vm/opto/loopopts.cpp Sat Apr 02 09:49:27 2011 -0700 +++ b/src/share/vm/opto/loopopts.cpp Sat Apr 02 10:54:15 2011 -0700 @@ -2139,9 +2139,12 @@ // // orig // -// stmt1 -// | -// v +// stmt1 +// | +// v +// loop predicate +// | +// v // loop<----+ // | | // stmt2 | @@ -2172,6 +2175,9 @@ // after clone loop // // stmt1 +// | +// v +// loop predicate // / \ // clone / \ orig // / \ @@ -2210,12 +2216,15 @@ // after partial peel // // stmt1 +// | +// v +// loop predicate // / // clone / orig // / TOP // / \ // v v -// TOP->region region----+ +// TOP->loop loop----+ // | | | // stmt2 stmt2 | // | | | @@ -2253,13 +2262,17 @@ // stmt1 // | // v +// stmt2 clone +// | +// v // ........> ifA clone // : / | // dom / | // : v v // : false true // : | | -// : | stmt2 clone +// : | v +// : | loop predicate // : | | // : | v // : | newloop<-----+ @@ -2289,6 +2302,7 @@ // bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) { + assert(!loop->_head->is_CountedLoop(), "Non-counted loop only"); if (!loop->_head->is_Loop()) { return false; } @@ -2316,6 +2330,7 @@ } } + Node* entry = head->in(LoopNode::EntryControl); int dd = dom_depth(head); // Step 1: find cut point @@ -2612,6 +2627,8 @@ // Backedge of the surviving new_head (the clone) is original last_peel _igvn.hash_delete(new_head_clone); + Node* new_entry = move_loop_predicates(entry, new_head_clone->in(LoopNode::EntryControl)); + new_head_clone->set_req(LoopNode::EntryControl, new_entry); new_head_clone->set_req(LoopNode::LoopBackControl, last_peel); _igvn._worklist.push(new_head_clone);