src/share/vm/opto/loopTransform.cpp

Print this page
rev 4327 : [mq]: JDK-8009181

@@ -884,12 +884,14 @@
 #endif
   C->set_major_progress();
 
   // Find common pieces of the loop being guarded with pre & post loops
   CountedLoopNode *main_head = loop->_head->as_CountedLoop();
+  guarantee(main_head != NULL, "no main head loop node");
   assert( main_head->is_normal_loop(), "" );
   CountedLoopEndNode *main_end = main_head->loopexit();
+  guarantee(main_end != NULL, "no main end loop node");
   assert( main_end->outcnt() == 2, "1 true, 1 false path only" );
   uint dd_main_head = dom_depth(main_head);
   uint max = main_head->outcnt();
 
   Node *pre_header= main_head->in(LoopNode::EntryControl);

@@ -2552,17 +2554,20 @@
 
   // store related values are ok
   ok.set(store->_idx);
   ok.set(store->in(MemNode::Memory)->_idx);
 
+  CountedLoopEndNode* head_exit = head->loopexit();
+  guarantee(head_exit != NULL, "no head exit loop node");
+
   // Loop structure is ok
   ok.set(head->_idx);
-  ok.set(head->loopexit()->_idx);
+  ok.set(head_exit->_idx);
   ok.set(head->phi()->_idx);
   ok.set(head->incr()->_idx);
-  ok.set(head->loopexit()->cmp_node()->_idx);
-  ok.set(head->loopexit()->in(1)->_idx);
+  ok.set(head_exit->cmp_node()->_idx);
+  ok.set(head_exit->in(1)->_idx);
 
   // Address elements are ok
   if (con)   ok.set(con->_idx);
   if (shift) ok.set(shift->_idx);
   if (conv)  ok.set(conv->_idx);