8203215: IdealLoopTree::split_outer_loop leaves phi-nodes with only one input
authorneliasso
Thu, 17 May 2018 12:08:32 +0200
changeset 50165 86f038c25410
parent 50164 88bf53770be5
child 50166 1d683e243d8d
8203215: IdealLoopTree::split_outer_loop leaves phi-nodes with only one input Summary: Make sure the phis are transformed Reviewed-by: roland, kvn, rbackman
src/hotspot/share/opto/loopnode.cpp
--- a/src/hotspot/share/opto/loopnode.cpp	Thu May 17 11:56:21 2018 +0200
+++ b/src/hotspot/share/opto/loopnode.cpp	Thu May 17 12:08:32 2018 +0200
@@ -2641,9 +2641,6 @@
   int old_progress = C->major_progress();
   uint orig_worklist_size = _igvn._worklist.size();
 
-  // Reset major-progress flag for the driver's heuristics
-  C->clear_major_progress();
-
 #ifndef PRODUCT
   // Capture for later assert
   uint unique = C->unique();
@@ -2714,11 +2711,16 @@
   if( !_verify_me && !_verify_only && _ltree_root->_child ) {
     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.
+      _igvn.optimize();
+
       // Re-build loop tree!
       _ltree_root->_child = NULL;
       _nodes.clear();
       reallocate_preorders();
       build_loop_tree();
+
       // Check for bailout, and return
       if (C->failing()) {
         return;
@@ -2730,6 +2732,9 @@
     }
   }
 
+  // Reset major-progress flag for the driver's heuristics
+  C->clear_major_progress();
+
   // Build Dominators for elision of NULL checks & loop finding.
   // Since nodes do not have a slot for immediate dominator, make
   // a persistent side array for that info indexed on node->_idx.