Mercurial > hg > truffle
comparison src/share/vm/opto/loopopts.cpp @ 8883:b9a918201d47
Merge with hsx25
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Sat, 06 Apr 2013 20:04:06 +0200 |
parents | 3b9368710f08 |
children | 1682bec79205 |
comparison
equal
deleted
inserted
replaced
8660:d47b52b0ff68 | 8883:b9a918201d47 |
---|---|
230 Node* dp = iff->as_If()->proj_out(pop == Op_IfTrue); | 230 Node* dp = iff->as_If()->proj_out(pop == Op_IfTrue); |
231 | 231 |
232 // Loop predicates may have depending checks which should not | 232 // Loop predicates may have depending checks which should not |
233 // be skipped. For example, range check predicate has two checks | 233 // be skipped. For example, range check predicate has two checks |
234 // for lower and upper bounds. | 234 // for lower and upper bounds. |
235 ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp->as_Proj()->_con)->as_Proj(); | 235 if (dp == NULL) |
236 return; | |
237 | |
238 ProjNode* dp_proj = dp->as_Proj(); | |
239 ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp_proj->_con)->as_Proj(); | |
236 if (exclude_loop_predicate && | 240 if (exclude_loop_predicate && |
237 is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate)) | 241 is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate)) |
238 return; // Let IGVN transformation change control dependence. | 242 return; // Let IGVN transformation change control dependence. |
239 | 243 |
240 IdealLoopTree *old_loop = get_loop(dp); | 244 IdealLoopTree *old_loop = get_loop(dp); |
864 // Replace 'n' with the new phi | 868 // Replace 'n' with the new phi |
865 _igvn.replace_node( n, phi ); | 869 _igvn.replace_node( n, phi ); |
866 | 870 |
867 // Now split the bool up thru the phi | 871 // Now split the bool up thru the phi |
868 Node *bolphi = split_thru_phi( bol, n_ctrl, -1 ); | 872 Node *bolphi = split_thru_phi( bol, n_ctrl, -1 ); |
873 guarantee(bolphi != NULL, "null boolean phi node"); | |
874 | |
869 _igvn.replace_node( bol, bolphi ); | 875 _igvn.replace_node( bol, bolphi ); |
870 assert( iff->in(1) == bolphi, "" ); | 876 assert( iff->in(1) == bolphi, "" ); |
877 | |
871 if( bolphi->Value(&_igvn)->singleton() ) | 878 if( bolphi->Value(&_igvn)->singleton() ) |
872 return; | 879 return; |
873 | 880 |
874 // Conditional-move? Must split up now | 881 // Conditional-move? Must split up now |
875 if( !iff->is_If() ) { | 882 if( !iff->is_If() ) { |
1626 } | 1633 } |
1627 | 1634 |
1628 //------------------------------ short_circuit_if ------------------------------------- | 1635 //------------------------------ short_circuit_if ------------------------------------- |
1629 // Force the iff control output to be the live_proj | 1636 // Force the iff control output to be the live_proj |
1630 Node* PhaseIdealLoop::short_circuit_if(IfNode* iff, ProjNode* live_proj) { | 1637 Node* PhaseIdealLoop::short_circuit_if(IfNode* iff, ProjNode* live_proj) { |
1638 guarantee(live_proj != NULL, "null projection"); | |
1631 int proj_con = live_proj->_con; | 1639 int proj_con = live_proj->_con; |
1632 assert(proj_con == 0 || proj_con == 1, "false or true projection"); | 1640 assert(proj_con == 0 || proj_con == 1, "false or true projection"); |
1633 Node *con = _igvn.intcon(proj_con); | 1641 Node *con = _igvn.intcon(proj_con); |
1634 set_ctrl(con, C->root()); | 1642 set_ctrl(con, C->root()); |
1635 if (iff) { | 1643 if (iff) { |
1684 | 1692 |
1685 proj->set_req(0, new_if); // reattach | 1693 proj->set_req(0, new_if); // reattach |
1686 set_idom(proj, new_if, ddepth); | 1694 set_idom(proj, new_if, ddepth); |
1687 | 1695 |
1688 ProjNode* new_exit = proj_clone(other_proj, new_if)->as_Proj(); | 1696 ProjNode* new_exit = proj_clone(other_proj, new_if)->as_Proj(); |
1697 guarantee(new_exit != NULL, "null exit node"); | |
1689 register_node(new_exit, get_loop(other_proj), new_if, ddepth); | 1698 register_node(new_exit, get_loop(other_proj), new_if, ddepth); |
1690 | 1699 |
1691 return new_exit; | 1700 return new_exit; |
1692 } | 1701 } |
1693 | 1702 |
1791 CmpNode* cmpu = bol->in(1)->as_Cmp(); | 1800 CmpNode* cmpu = bol->in(1)->as_Cmp(); |
1792 if (cmpu->Opcode() != Op_CmpU) return NULL; | 1801 if (cmpu->Opcode() != Op_CmpU) return NULL; |
1793 int stride = stride_of_possible_iv(if_cmpu); | 1802 int stride = stride_of_possible_iv(if_cmpu); |
1794 if (stride == 0) return NULL; | 1803 if (stride == 0) return NULL; |
1795 | 1804 |
1796 ProjNode* lp_continue = stay_in_loop(if_cmpu, loop)->as_Proj(); | 1805 Node* lp_proj = stay_in_loop(if_cmpu, loop); |
1806 guarantee(lp_proj != NULL, "null loop node"); | |
1807 | |
1808 ProjNode* lp_continue = lp_proj->as_Proj(); | |
1797 ProjNode* lp_exit = if_cmpu->proj_out(!lp_continue->is_IfTrue())->as_Proj(); | 1809 ProjNode* lp_exit = if_cmpu->proj_out(!lp_continue->is_IfTrue())->as_Proj(); |
1798 | 1810 |
1799 Node* limit = NULL; | 1811 Node* limit = NULL; |
1800 if (stride > 0) { | 1812 if (stride > 0) { |
1801 limit = cmpu->in(2); | 1813 limit = cmpu->in(2); |
1803 limit = _igvn.makecon(TypeInt::ZERO); | 1815 limit = _igvn.makecon(TypeInt::ZERO); |
1804 set_ctrl(limit, C->root()); | 1816 set_ctrl(limit, C->root()); |
1805 } | 1817 } |
1806 // Create a new region on the exit path | 1818 // Create a new region on the exit path |
1807 RegionNode* reg = insert_region_before_proj(lp_exit); | 1819 RegionNode* reg = insert_region_before_proj(lp_exit); |
1820 guarantee(reg != NULL, "null region node"); | |
1808 | 1821 |
1809 // Clone the if-cmpu-true-false using a signed compare | 1822 // Clone the if-cmpu-true-false using a signed compare |
1810 BoolTest::mask rel_i = stride > 0 ? bol->_test._test : BoolTest::ge; | 1823 BoolTest::mask rel_i = stride > 0 ? bol->_test._test : BoolTest::ge; |
1811 ProjNode* cmpi_exit = insert_if_before_proj(cmpu->in(1), Signed, rel_i, limit, lp_continue); | 1824 ProjNode* cmpi_exit = insert_if_before_proj(cmpu->in(1), Signed, rel_i, limit, lp_continue); |
1812 reg->add_req(cmpi_exit); | 1825 reg->add_req(cmpi_exit); |