< prev index next >

src/hotspot/share/opto/loopnode.cpp

Print this page

        

@@ -2707,15 +2707,23 @@
   _ltree_root->set_nest( 0 );
 
   // Split shared headers and insert loop landing pads.
   // Do not bother doing this on the Root loop of course.
   if( !_verify_me && !_verify_only && _ltree_root->_child ) {
+    bool change = true;
+    // Fix point iterate beautify_loops until it returns false
+    // Then no strucutral change has been made.
+    while (change) {
+      change = false;
     C->print_method(PHASE_BEFORE_BEAUTIFY_LOOPS, 3);
     if( _ltree_root->_child->beautify_loops( this ) ) {
-      // IdealLoopTree::split_outer_loop may produce phi-nodes with a single in edge.
-      // Transform them away.
+        // IdealLoopTree::split_outer_loop may reduce phi-nodes to loop invariants,
+        // and we want to get rid of them
       _igvn.optimize();
+        change = true; // do one more iteration after clean up
+        orig_worklist_size = _igvn._worklist.size();
+      }
 
       // Re-build loop tree!
       _ltree_root->_child = NULL;
       _nodes.clear();
       reallocate_preorders();
< prev index next >