hotspot/src/share/vm/opto/ifnode.cpp
changeset 3268 f034e0c86895
parent 2131 98f9cef66a34
child 4016 9c11d6d519f7
child 3795 6227ff014cfe
--- a/hotspot/src/share/vm/opto/ifnode.cpp	Wed Jul 15 13:37:35 2009 -0700
+++ b/hotspot/src/share/vm/opto/ifnode.cpp	Thu Jul 16 14:10:42 2009 -0700
@@ -378,7 +378,18 @@
 
   // Force the original merge dead
   igvn->hash_delete(r);
-  r->set_req_X(0,NULL,igvn);
+  // First, remove region's dead users.
+  for (DUIterator_Last lmin, l = r->last_outs(lmin); l >= lmin;) {
+    Node* u = r->last_out(l);
+    if( u == r ) {
+      r->set_req(0, NULL);
+    } else {
+      assert(u->outcnt() == 0, "only dead users");
+      igvn->remove_dead_node(u);
+    }
+    l -= 1;
+  }
+  igvn->remove_dead_node(r);
 
   // Now remove the bogus extra edges used to keep things alive
   igvn->remove_dead_node( hook );