8005956: C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block
authoradlertz
Mon, 03 Jun 2013 12:39:33 -0700
changeset 17877 8ffbff23b733
parent 17876 7313e6d57e36
child 17878 ec32f692e27b
8005956: C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block Summary: Disable re-materialization of reaching definitions (which have live inputs) for phi nodes when spilling. Reviewed-by: twisti, kvn
hotspot/src/share/vm/opto/reg_split.cpp
--- a/hotspot/src/share/vm/opto/reg_split.cpp	Mon Jun 03 08:52:20 2013 +0200
+++ b/hotspot/src/share/vm/opto/reg_split.cpp	Mon Jun 03 12:39:33 2013 -0700
@@ -51,6 +51,15 @@
 
 static const char out_of_nodes[] = "out of nodes during split";
 
+static bool contains_no_live_range_input(const Node* def) {
+  for (uint i = 1; i < def->req(); ++i) {
+    if (def->in(i) != NULL && def->in_RegMask(i).is_NotEmpty()) {
+      return false;
+    }
+  }
+  return true;
+}
+
 //------------------------------get_spillcopy_wide-----------------------------
 // Get a SpillCopy node with wide-enough masks.  Use the 'wide-mask', the
 // wide ideal-register spill-mask if possible.  If the 'wide-mask' does
@@ -1312,7 +1321,7 @@
       Node *def = Reaches[pidx][slidx];
       assert( def, "must have reaching def" );
       // If input up/down sense and reg-pressure DISagree
-      if( def->rematerialize() ) {
+      if (def->rematerialize() && contains_no_live_range_input(def)) {
         // Place the rematerialized node above any MSCs created during
         // phi node splitting.  end_idx points at the insertion point
         // so look at the node before it.