hotspot/src/share/vm/opto/ifnode.cpp

Print this page
rev 611 : Merge

@@ -1,10 +1,10 @@
 #ifdef USE_PRAGMA_IDENT_SRC
 #pragma ident "@(#)ifnode.cpp   1.63 07/10/23 13:12:51 JVM"
 #endif
 /*
- * Copyright 2000-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -726,10 +726,15 @@
 
   // Check for diamond pattern
   int true_path = phi->is_diamond_phi();
   if( true_path == 0 ) return NULL;
 
+  // Make sure that iff and the control of the phi are different. This
+  // should really only happen for dead control flow since it requires
+  // an illegal cycle.
+  if (phi->in(0)->in(1)->in(0) == iff) return NULL;
+
   // phi->region->if_proj->ifnode->bool->cmp
   BoolNode *bol2 = phi->in(0)->in(1)->in(0)->in(1)->as_Bool();
   
   // Now get the 'sense' of the test correct so we can plug in
   // either iff2->in(1) or its complement.

@@ -752,10 +757,11 @@
   if( true_path == 2 ) {
     flip = 1-flip;
   }
 
   Node* new_bol = (flip ? phase->transform( bol2->negate(phase) ) : bol2);
+  assert(new_bol != iff->in(1), "must make progress");
   iff->set_req(1, new_bol);
   // Intervening diamond probably goes dead
   phase->C->set_major_progress();
   return iff;
 }