< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page
rev 54030 : 8219517: assert(false) failed: infinite loop in PhaseIterGVN::optimize
Reviewed-by:

@@ -1392,10 +1392,18 @@
     if (cnt == 3) {
       for (uint i = 1; i < cnt; i++) {
         Node* in = mem->in(i);
         Node*  m = optimize_memory_chain(in, t_oop, this, phase);
         if (m == mem) {
+          if (i == 1) {
+            // if the first was a loop, check second edge to.
+            // 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
         }
       }
     }
< prev index next >