src/share/vm/opto/loopUnswitch.cpp

Print this page

        

@@ -49,10 +49,13 @@
 // (ie. clone loop with an invariant test that does not exit the loop)
 bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const {
   if( !LoopUnswitching ) {
     return false;
   }
+  if (!_head->is_Loop()) {
+    return false; 
+  }
   uint nodes_left = MaxNodeLimit - phase->C->unique();
   if (2 * _body.size() > nodes_left) {
     return false; // Too speculative if running low on nodes.
   }
   LoopNode* head = _head->as_Loop();