< prev index next >

src/share/vm/opto/cfgnode.cpp

Print this page

        

@@ -1934,12 +1934,19 @@
         // (saw_self == true). If all other inputs also references this phi
         // (directly or through data nodes) - it is dead loop.
         bool saw_safe_input = false;
         for (uint j = 1; j < req(); ++j) {
           Node *n = in(j);
-          if (n->is_MergeMem() && n->as_MergeMem()->base_memory() == this)
+          if (n->is_MergeMem() && n->as_MergeMem()->base_memory() == this) {
             continue;              // skip known cases
+          }
+          // TOP inputs should not be counted as safe inputs because if the
+          // Phi references itself through all other inputs then splitting the
+          // Phi through memory merges would create dead loop at later stage.
+          if (n == top) {
+            continue;
+          }
           if (!is_unsafe_data_reference(n)) {
             saw_safe_input = true; // found safe input
             break;
           }
         }
< prev index next >