hotspot/src/share/vm/opto/replacednodes.cpp
changeset 43963 6845bb645be5
parent 37248 11a660dbbb8e
equal deleted inserted replaced
43962:8d1c5fdcdf76 43963:6845bb645be5
    90     _replaced_nodes->clear();
    90     _replaced_nodes->clear();
    91   }
    91   }
    92 }
    92 }
    93 
    93 
    94 // Perfom node replacement (used when returning to caller)
    94 // Perfom node replacement (used when returning to caller)
    95 void ReplacedNodes::apply(Node* n) {
    95 void ReplacedNodes::apply(Node* n, uint idx) {
    96   if (is_empty()) {
    96   if (is_empty()) {
    97     return;
    97     return;
    98   }
    98   }
    99   for (int i = 0; i < _replaced_nodes->length(); i++) {
    99   for (int i = 0; i < _replaced_nodes->length(); i++) {
   100     ReplacedNode replaced = _replaced_nodes->at(i);
   100     ReplacedNode replaced = _replaced_nodes->at(i);
   101     n->replace_edge(replaced.initial(), replaced.improved());
   101     // Only apply if improved node was created in a callee to avoid
       
   102     // issues with irreducible loops in the caller
       
   103     if (replaced.improved()->_idx >= idx) {
       
   104       n->replace_edge(replaced.initial(), replaced.improved());
       
   105     }
   102   }
   106   }
   103 }
   107 }
   104 
   108 
   105 static void enqueue_use(Node* n, Node* use, Unique_Node_List& work) {
   109 static void enqueue_use(Node* n, Node* use, Unique_Node_List& work) {
   106   if (use->is_Phi()) {
   110   if (use->is_Phi()) {