< prev index next >

src/share/vm/opto/ifnode.cpp

Print this page
rev 7756 : 8071996: split_if accesses NULL region of ConstraintCast

@@ -143,14 +143,22 @@
     // Make sure we can account for all Phi uses
     for (DUIterator_Fast kmax, k = u->fast_outs(kmax); k < kmax; k++) {
       Node* v = u->fast_out(k); // User of the phi
       // CNC - Allow only really simple patterns.
       // In particular I disallow AddP of the Phi, a fairly common pattern
-      if( v == cmp ) continue;  // The compare is OK
-      if( (v->is_ConstraintCast()) &&
-          v->in(0)->in(0) == iff )
+      if (v == cmp) continue;  // The compare is OK
+      if (v->is_ConstraintCast()) {
+        // If the cast is derived from data flow edges, it may not have a region.
+        // If so, it should be save to split. But I'm not sure whether follow-up code
+        // can deal with this. So skip.
+        if (v->in(0) == NULL) {
+          return NULL;
+        }
+        if (v->in(0)->in(0) == iff) {
         continue;               // CastPP/II of the IfNode is OK
+        }
+      }
       // Disabled following code because I cannot tell if exactly one
       // path dominates without a real dominator check. CNC 9/9/1999
       //uint vop = v->Opcode();
       //if( vop == Op_Phi ) {     // Phi from another merge point might be OK
       //  Node *r = v->in(0);     // Get controlling point
< prev index next >