diff options
author | kvn <none@none> | 2013-08-16 14:11:40 -0700 |
---|---|---|
committer | kvn <none@none> | 2013-08-16 14:11:40 -0700 |
commit | 9ca8ff7a44cbabcb30ab23f2d178f553b1465aa8 (patch) | |
tree | c674a19f98e784ca21c088492b95c22f50133a8c /src/share/vm/opto/chaitin.cpp | |
parent | 0349cc0b8233f670a4a6227dde7a3970ec573f65 (diff) |
8021898: Broken JIT compiler optimization for loop unswitching
Summary: fix method clone_projs() to clone all related MachProj nodes.
Reviewed-by: roland, adlertz
Diffstat (limited to 'src/share/vm/opto/chaitin.cpp')
-rw-r--r-- | src/share/vm/opto/chaitin.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/share/vm/opto/chaitin.cpp b/src/share/vm/opto/chaitin.cpp index d19cf1709..c2f8d40b2 100644 --- a/src/share/vm/opto/chaitin.cpp +++ b/src/share/vm/opto/chaitin.cpp @@ -287,21 +287,26 @@ void PhaseChaitin::new_lrg(const Node *x, uint lrg) { } -bool PhaseChaitin::clone_projs_shared(Block *b, uint idx, Node *con, Node *copy, uint max_lrg_id) { - Block* bcon = _cfg.get_block_for_node(con); - uint cindex = bcon->find_node(con); - Node *con_next = bcon->_nodes[cindex+1]; - if (con_next->in(0) != con || !con_next->is_MachProj()) { - return false; // No MachProj's follow - } - - // Copy kills after the cloned constant - Node *kills = con_next->clone(); - kills->set_req(0, copy); - b->_nodes.insert(idx, kills); - _cfg.map_node_to_block(kills, b); - new_lrg(kills, max_lrg_id); - return true; +int PhaseChaitin::clone_projs(Block* b, uint idx, Node* orig, Node* copy, uint& max_lrg_id) { + assert(b->find_node(copy) == (idx - 1), "incorrect insert index for copy kill projections"); + DEBUG_ONLY( Block* borig = _cfg.get_block_for_node(orig); ) + int found_projs = 0; + uint cnt = orig->outcnt(); + for (uint i = 0; i < cnt; i++) { + Node* proj = orig->raw_out(i); + if (proj->is_MachProj()) { + assert(proj->outcnt() == 0, "only kill projections are expected here"); + assert(_cfg.get_block_for_node(proj) == borig, "incorrect block for kill projections"); + found_projs++; + // Copy kill projections after the cloned node + Node* kills = proj->clone(); + kills->set_req(0, copy); + b->_nodes.insert(idx++, kills); + _cfg.map_node_to_block(kills, b); + new_lrg(kills, max_lrg_id++); + } + } + return found_projs; } // Renumber the live ranges to compact them. Makes the IFG smaller. |