comparison src/share/vm/opto/chaitin.cpp @ 12075:4b2838704fd5

8021898: Broken JIT compiler optimization for loop unswitching Summary: fix method clone_projs() to clone all related MachProj nodes. Reviewed-by: roland, adlertz
author kvn
date Fri, 16 Aug 2013 14:11:40 -0700
parents adb9a7d94cb5
children 650868c062a9
comparison
equal deleted inserted replaced
12074:d18b10b1fd09 12075:4b2838704fd5
285 // Make the Union-Find mapping an identity function 285 // Make the Union-Find mapping an identity function
286 _lrg_map.uf_extend(lrg, lrg); 286 _lrg_map.uf_extend(lrg, lrg);
287 } 287 }
288 288
289 289
290 bool PhaseChaitin::clone_projs_shared(Block *b, uint idx, Node *con, Node *copy, uint max_lrg_id) { 290 int PhaseChaitin::clone_projs(Block* b, uint idx, Node* orig, Node* copy, uint& max_lrg_id) {
291 Block* bcon = _cfg.get_block_for_node(con); 291 assert(b->find_node(copy) == (idx - 1), "incorrect insert index for copy kill projections");
292 uint cindex = bcon->find_node(con); 292 DEBUG_ONLY( Block* borig = _cfg.get_block_for_node(orig); )
293 Node *con_next = bcon->_nodes[cindex+1]; 293 int found_projs = 0;
294 if (con_next->in(0) != con || !con_next->is_MachProj()) { 294 uint cnt = orig->outcnt();
295 return false; // No MachProj's follow 295 for (uint i = 0; i < cnt; i++) {
296 } 296 Node* proj = orig->raw_out(i);
297 297 if (proj->is_MachProj()) {
298 // Copy kills after the cloned constant 298 assert(proj->outcnt() == 0, "only kill projections are expected here");
299 Node *kills = con_next->clone(); 299 assert(_cfg.get_block_for_node(proj) == borig, "incorrect block for kill projections");
300 kills->set_req(0, copy); 300 found_projs++;
301 b->_nodes.insert(idx, kills); 301 // Copy kill projections after the cloned node
302 _cfg.map_node_to_block(kills, b); 302 Node* kills = proj->clone();
303 new_lrg(kills, max_lrg_id); 303 kills->set_req(0, copy);
304 return true; 304 b->_nodes.insert(idx++, kills);
305 _cfg.map_node_to_block(kills, b);
306 new_lrg(kills, max_lrg_id++);
307 }
308 }
309 return found_projs;
305 } 310 }
306 311
307 // Renumber the live ranges to compact them. Makes the IFG smaller. 312 // Renumber the live ranges to compact them. Makes the IFG smaller.
308 void PhaseChaitin::compact() { 313 void PhaseChaitin::compact() {
309 // Current the _uf_map contains a series of short chains which are headed 314 // Current the _uf_map contains a series of short chains which are headed