< prev index next >

src/hotspot/share/opto/matcher.cpp

Print this page

        

@@ -2064,16 +2064,10 @@
       }
       if (is_visited(n)) {   // Visited already?
         // Node is shared and has no reason to clone.  Flag it as shared.
         // This causes it to match into a register for the sharing.
         set_shared(n);       // Flag as shared and
-        if (n->is_DecodeNarrowPtr()) {
-          // Oop field/array element loads must be shared but since
-          // they are shared through a DecodeN they may appear to have
-          // a single use so force sharing here.
-          set_shared(n->in(1));
-        }
         mstack.pop();        // remove node from stack
         continue;
       }
       nstate = Visit; // Not already visited; so visit now
     }

@@ -2102,10 +2096,17 @@
         if( _must_clone[mop] ) {
           mstack.push(m, Visit);
           continue; // for(int i = ...)
         }
 
+        if( mop == Op_AddP && m->in(AddPNode::Base)->is_DecodeNarrowPtr()) {
+          // Bases used in addresses must be shared but since
+          // they are shared through a DecodeN they may appear
+          // to have a single use so force sharing here.
+          set_shared(m->in(AddPNode::Base)->in(1));
+        }
+
         // if 'n' and 'm' are part of a graph for BMI instruction, clone this node.
 #ifdef X86
         if (UseBMI1Instructions && is_bmi_pattern(n, m)) {
           mstack.push(m, Visit);
           continue;
< prev index next >