hotspot/src/share/vm/opto/postaloc.cpp
changeset 243 79b67a7a584a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
--- a/hotspot/src/share/vm/opto/postaloc.cpp	Tue Mar 18 23:54:17 2008 -0700
+++ b/hotspot/src/share/vm/opto/postaloc.cpp	Wed Mar 19 15:14:36 2008 -0700
@@ -253,7 +253,8 @@
 // nodes can represent the same constant so the type and rule of the
 // MachNode must be checked to ensure equivalence.
 //
-bool PhaseChaitin::eliminate_copy_of_constant(Node* val, Block *current_block,
+bool PhaseChaitin::eliminate_copy_of_constant(Node* val, Node* n,
+                                              Block *current_block,
                                               Node_List& value, Node_List& regnd,
                                               OptoReg::Name nreg, OptoReg::Name nreg2) {
   if (value[nreg] != val && val->is_Con() &&
@@ -269,12 +270,12 @@
     // Since they are equivalent the second one if redundant and can
     // be removed.
     //
-    // val will be replaced with the old value but val might have
+    // n will be replaced with the old value but n might have
     // kills projections associated with it so remove them now so that
     // yank_if_dead will be able to elminate the copy once the uses
     // have been transferred to the old[value].
-    for (DUIterator_Fast imax, i = val->fast_outs(imax); i < imax; i++) {
-      Node* use = val->fast_out(i);
+    for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
+      Node* use = n->fast_out(i);
       if (use->is_Proj() && use->outcnt() == 0) {
         // Kill projections have no users and one input
         use->set_req(0, C->top());
@@ -521,7 +522,7 @@
         // then 'n' is a useless copy.  Do not update the register->node
         // mapping so 'n' will go dead.
         if( value[nreg] != val ) {
-          if (eliminate_copy_of_constant(val, b, value, regnd, nreg, OptoReg::Bad)) {
+          if (eliminate_copy_of_constant(val, n, b, value, regnd, nreg, OptoReg::Bad)) {
             n->replace_by(regnd[nreg]);
             j -= yank_if_dead(n,b,&value,&regnd);
           } else {
@@ -549,7 +550,7 @@
           nreg_lo = tmp.find_first_elem();
         }
         if( value[nreg] != val || value[nreg_lo] != val ) {
-          if (eliminate_copy_of_constant(n, b, value, regnd, nreg, nreg_lo)) {
+          if (eliminate_copy_of_constant(val, n, b, value, regnd, nreg, nreg_lo)) {
             n->replace_by(regnd[nreg]);
             j -= yank_if_dead(n,b,&value,&regnd);
           } else {