Merge
authordrchase
Sat, 22 Nov 2014 03:10:33 +0000
changeset 27705 a81a28a9bc8a
parent 27704 88c9f3b507ff (diff)
parent 27703 6524c73c4f07 (current diff)
child 27706 3f10f4ac2bd6
Merge
--- a/hotspot/src/share/vm/opto/ifg.cpp	Fri Nov 21 21:08:48 2014 -0500
+++ b/hotspot/src/share/vm/opto/ifg.cpp	Sat Nov 22 03:10:33 2014 +0000
@@ -527,6 +527,22 @@
   Node* def = n->in(0);
   if (!n->is_Proj() ||
       (_lrg_map.live_range_id(def) && !liveout->member(_lrg_map.live_range_id(def)))) {
+    if (n->is_MachProj()) {
+      // Don't remove KILL projections if their "defining" nodes have
+      // memory effects (have SCMemProj projection node) -
+      // they are not dead even when their result is not used.
+      // For example, compareAndSwapL (and other CAS) and EncodeISOArray nodes.
+      // The method add_input_to_liveout() keeps such nodes alive (put them on liveout list)
+      // when it sees SCMemProj node in a block. Unfortunately SCMemProj node could be placed
+      // in block in such order that KILL MachProj nodes are processed first.
+      uint cnt = def->outcnt();
+      for (uint i = 0; i < cnt; i++) {
+        Node* proj = def->raw_out(i);
+        if (proj->Opcode() == Op_SCMemProj) {
+          return false;
+        }
+      }
+    }
     b->remove_node(location);
     LRG& lrg = lrgs(lid);
     if (lrg._def == n) {