163
164 ProjNode* proj_false = invar_iff->proj_out(0)->as_Proj();
165
166 // Hoist invariant casts out of each loop to the appropriate
167 // control projection.
168
169 Node_List worklist;
170
171 for (DUIterator_Fast imax, i = unswitch_iff->fast_outs(imax); i < imax; i++) {
172 ProjNode* proj= unswitch_iff->fast_out(i)->as_Proj();
173 // Copy to a worklist for easier manipulation
174 for (DUIterator_Fast jmax, j = proj->fast_outs(jmax); j < jmax; j++) {
175 Node* use = proj->fast_out(j);
176 if (use->Opcode() == Op_CheckCastPP && loop->is_invariant(use->in(1))) {
177 worklist.push(use);
178 }
179 }
180 ProjNode* invar_proj = invar_iff->proj_out(proj->_con)->as_Proj();
181 while (worklist.size() > 0) {
182 Node* use = worklist.pop();
183 Node* nuse = use->clone();
184 nuse->set_req(0, invar_proj);
185 _igvn.replace_input_of(use, 1, nuse);
186 register_new_node(nuse, invar_proj);
187 // Same for the clone
188 Node* use_clone = old_new[use->_idx];
189 _igvn.replace_input_of(use_clone, 1, nuse);
190 }
191 }
192
193 // Hardwire the control paths in the loops into if(true) and if(false)
194 _igvn.rehash_node_delayed(unswitch_iff);
195 short_circuit_if(unswitch_iff, proj_true);
196
197 IfNode* unswitch_iff_clone = old_new[unswitch_iff->_idx]->as_If();
198 _igvn.rehash_node_delayed(unswitch_iff_clone);
199 short_circuit_if(unswitch_iff_clone, proj_false);
200
201 // Reoptimize loops
202 loop->record_for_igvn();
|
163
164 ProjNode* proj_false = invar_iff->proj_out(0)->as_Proj();
165
166 // Hoist invariant casts out of each loop to the appropriate
167 // control projection.
168
169 Node_List worklist;
170
171 for (DUIterator_Fast imax, i = unswitch_iff->fast_outs(imax); i < imax; i++) {
172 ProjNode* proj= unswitch_iff->fast_out(i)->as_Proj();
173 // Copy to a worklist for easier manipulation
174 for (DUIterator_Fast jmax, j = proj->fast_outs(jmax); j < jmax; j++) {
175 Node* use = proj->fast_out(j);
176 if (use->Opcode() == Op_CheckCastPP && loop->is_invariant(use->in(1))) {
177 worklist.push(use);
178 }
179 }
180 ProjNode* invar_proj = invar_iff->proj_out(proj->_con)->as_Proj();
181 while (worklist.size() > 0) {
182 Node* use = worklist.pop();
183 assert(use->Opcode() != Op_ShenandoahWriteBarrier, "not with wbs yet");
184 Node* nuse = use->clone();
185 nuse->set_req(0, invar_proj);
186 _igvn.replace_input_of(use, 1, nuse);
187 register_new_node(nuse, invar_proj);
188 // Same for the clone
189 Node* use_clone = old_new[use->_idx];
190 _igvn.replace_input_of(use_clone, 1, nuse);
191 }
192 }
193
194 // Hardwire the control paths in the loops into if(true) and if(false)
195 _igvn.rehash_node_delayed(unswitch_iff);
196 short_circuit_if(unswitch_iff, proj_true);
197
198 IfNode* unswitch_iff_clone = old_new[unswitch_iff->_idx]->as_If();
199 _igvn.rehash_node_delayed(unswitch_iff_clone);
200 short_circuit_if(unswitch_iff_clone, proj_false);
201
202 // Reoptimize loops
203 loop->record_for_igvn();
|