6684385: Loop unswitching crashes without LoopNode
authorrasbold
Wed, 09 Apr 2008 09:25:45 -0700
changeset 355 22d39d357cca
parent 354 3b42d6fdcb82
child 356 b5ca660b4072
6684385: Loop unswitching crashes without LoopNode Summary: Without LoopNode, exit early from loop unswitching and partial peeling Reviewed-by: kvn, never, sgoldman
hotspot/src/share/vm/opto/loopUnswitch.cpp
hotspot/src/share/vm/opto/loopopts.cpp
--- a/hotspot/src/share/vm/opto/loopUnswitch.cpp	Tue Apr 08 12:23:15 2008 -0400
+++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp	Wed Apr 09 09:25:45 2008 -0700
@@ -51,6 +51,9 @@
   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.
--- a/hotspot/src/share/vm/opto/loopopts.cpp	Tue Apr 08 12:23:15 2008 -0400
+++ b/hotspot/src/share/vm/opto/loopopts.cpp	Wed Apr 09 09:25:45 2008 -0700
@@ -2257,6 +2257,9 @@
 //
 bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) {
 
+  if (!loop->_head->is_Loop()) {
+    return false;  }
+
   LoopNode *head  = loop->_head->as_Loop();
 
   if (head->is_partial_peel_loop() || head->partial_peel_has_failed()) {