src/hotspot/share/opto/cfgnode.cpp
changeset 48145 f913f6dba2d3
parent 47882 a93ce8f7bddb
child 48595 5d699d81c10c
--- a/src/hotspot/share/opto/cfgnode.cpp	Tue Nov 28 21:04:42 2017 +0530
+++ b/src/hotspot/share/opto/cfgnode.cpp	Tue Nov 28 11:59:16 2017 +0100
@@ -571,6 +571,18 @@
       return NULL;
     } else if (can_reshape) {   // Optimization phase - remove the node
       PhaseIterGVN *igvn = phase->is_IterGVN();
+      // Strip mined (inner) loop is going away, remove outer loop.
+      if (is_CountedLoop() &&
+          as_Loop()->is_strip_mined()) {
+        Node* outer_sfpt = as_CountedLoop()->outer_safepoint();
+        Node* outer_out = as_CountedLoop()->outer_loop_exit();
+        if (outer_sfpt != NULL && outer_out != NULL) {
+          Node* in = outer_sfpt->in(0);
+          igvn->replace_node(outer_out, in);
+          LoopNode* outer = as_CountedLoop()->outer_loop();
+          igvn->replace_input_of(outer, LoopNode::LoopBackControl, igvn->C->top());
+        }
+      }
       Node *parent_ctrl;
       if( cnt == 0 ) {
         assert( req() == 1, "no inputs expected" );