diff src/share/vm/opto/postaloc.cpp @ 400:cc80376deb0c

6667595: Set probability FAIR for pre-, post- loops and ALWAYS for main loop Summary: Fix loop's probability. Add optimizations to avoid spilling. Change InlineSmallCode to product flag. Reviewed-by: never
author kvn
date Thu, 02 Oct 2008 08:37:44 -0700
parents d1605aabd0a1
children 98cb887364d3
line wrap: on
line diff
--- a/src/share/vm/opto/postaloc.cpp	Tue Sep 30 15:53:55 2008 -0700
+++ b/src/share/vm/opto/postaloc.cpp	Thu Oct 02 08:37:44 2008 -0700
@@ -34,7 +34,7 @@
 #endif
 }
 
-//------------------------------may_be_copy_of_callee-----------------------------
+//---------------------------may_be_copy_of_callee-----------------------------
 // Check to see if we can possibly be a copy of a callee-save value.
 bool PhaseChaitin::may_be_copy_of_callee( Node *def ) const {
   // Short circuit if there are no callee save registers
@@ -225,6 +225,20 @@
 
   // Scan all registers to see if this value is around already
   for( uint reg = 0; reg < (uint)_max_reg; reg++ ) {
+    if (reg == (uint)nk_reg) {
+      // Found ourselves so check if there is only one user of this
+      // copy and keep on searching for a better copy if so.
+      bool ignore_self = true;
+      x = n->in(k);
+      DUIterator_Fast imax, i = x->fast_outs(imax);
+      Node* first = x->fast_out(i); i++;
+      while (i < imax && ignore_self) {
+        Node* use = x->fast_out(i); i++;
+        if (use != first) ignore_self = false;
+      }
+      if (ignore_self) continue;
+    }
+
     Node *vv = value[reg];
     if( !single ) {             // Doubles check for aligned-adjacent pair
       if( (reg&1)==0 ) continue;  // Wrong half of a pair