8219517: assert(false) failed: infinite loop in PhaseIterGVN::optimize
authorneliasso
Wed, 13 Mar 2019 15:22:28 +0100
changeset 54101 195309a6c7d5
parent 54100 1a6a5a0260a7
child 54102 fab8496eb541
8219517: assert(false) failed: infinite loop in PhaseIterGVN::optimize Reviewed-by: kvn, thartmann
src/hotspot/share/opto/memnode.cpp
--- a/src/hotspot/share/opto/memnode.cpp	Wed Mar 13 07:16:57 2019 -0700
+++ b/src/hotspot/share/opto/memnode.cpp	Wed Mar 13 15:22:28 2019 +0100
@@ -1394,6 +1394,14 @@
         Node* in = mem->in(i);
         Node*  m = optimize_memory_chain(in, t_oop, this, phase);
         if (m == mem) {
+          if (i == 1) {
+            // if the first edge was a loop, check second edge too.
+            // If both are replaceable - we are in an infinite loop
+            Node *n = optimize_memory_chain(mem->in(2), t_oop, this, phase);
+            if (n == mem) {
+              break;
+            }
+          }
           set_req(Memory, mem->in(cnt - i));
           return this; // made change
         }