89 _replaced_nodes->clear(); |
89 _replaced_nodes->clear(); |
90 } |
90 } |
91 } |
91 } |
92 |
92 |
93 // Perfom node replacement (used when returning to caller) |
93 // Perfom node replacement (used when returning to caller) |
94 void ReplacedNodes::apply(Node* n) { |
94 void ReplacedNodes::apply(Node* n, uint idx) { |
95 if (is_empty()) { |
95 if (is_empty()) { |
96 return; |
96 return; |
97 } |
97 } |
98 for (int i = 0; i < _replaced_nodes->length(); i++) { |
98 for (int i = 0; i < _replaced_nodes->length(); i++) { |
99 ReplacedNode replaced = _replaced_nodes->at(i); |
99 ReplacedNode replaced = _replaced_nodes->at(i); |
100 n->replace_edge(replaced.initial(), replaced.improved()); |
100 // Only apply if improved node was created in a callee to avoid |
|
101 // issues with irreducible loops in the caller |
|
102 if (replaced.improved()->_idx >= idx) { |
|
103 n->replace_edge(replaced.initial(), replaced.improved()); |
|
104 } |
101 } |
105 } |
102 } |
106 } |
103 |
107 |
104 static void enqueue_use(Node* n, Node* use, Unique_Node_List& work) { |
108 static void enqueue_use(Node* n, Node* use, Unique_Node_List& work) { |
105 if (use->is_Phi()) { |
109 if (use->is_Phi()) { |