src/hotspot/share/opto/compile.cpp
changeset 53429 1b292ae4eb50
parent 53220 c14b7b6a9b2f
child 53594 47a8fdf84424
--- a/src/hotspot/share/opto/compile.cpp	Tue Jan 22 09:27:19 2019 -0500
+++ b/src/hotspot/share/opto/compile.cpp	Tue Jan 22 18:25:56 2019 +0100
@@ -2188,13 +2188,16 @@
 // They were inserted during parsing (see add_safepoint()) to make
 // infinite loops without calls or exceptions visible to root, i.e.,
 // useful.
-void Compile::remove_root_to_sfpts_edges() {
+void Compile::remove_root_to_sfpts_edges(PhaseIterGVN& igvn) {
   Node *r = root();
   if (r != NULL) {
     for (uint i = r->req(); i < r->len(); ++i) {
       Node *n = r->in(i);
       if (n != NULL && n->is_SafePoint()) {
         r->rm_prec(i);
+        if (n->outcnt() == 0) {
+          igvn.remove_dead_node(n);
+        }
         --i;
       }
     }
@@ -2263,7 +2266,7 @@
 
   // Now that all inlining is over, cut edge from root to loop
   // safepoints
-  remove_root_to_sfpts_edges();
+  remove_root_to_sfpts_edges(igvn);
 
   // Remove the speculative part of types and clean up the graph from
   // the extra CastPP nodes whose only purpose is to carry them. Do