changeset 7816:b50281ff91ce

8071996: split_if accesses NULL region of ConstraintCast Reviewed-by: kvn
author goetz
date Fri, 30 Jan 2015 12:53:56 +0100
parents a4f200a81135
children 048d681ebfe2
files src/share/vm/opto/ifnode.cpp
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/ifnode.cpp	Tue Feb 03 09:56:21 2015 +0000
+++ b/src/share/vm/opto/ifnode.cpp	Fri Jan 30 12:53:56 2015 +0100
@@ -145,10 +145,18 @@
       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 )
-        continue;               // CastPP/II of the IfNode is OK
+      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 control edge.
+        // If so, it should be safe to split. But follow-up code can not deal with
+        // this (l. 359). 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();