@@ -334,9 +334,11 @@ Node *PhaseIdealLoop::has_local_phi_input( Node *n ) {
334334 // We allow the special case of AddP's with no local inputs.
335335 // This allows us to split-up address expressions.
336336 if (m->is_AddP () &&
337- get_ctrl (m->in (2 )) != n_ctrl &&
338- get_ctrl (m->in (3 )) != n_ctrl) {
339- // Move the AddP up to dominating point
337+ get_ctrl (m->in (AddPNode::Base)) != n_ctrl &&
338+ get_ctrl (m->in (AddPNode::Address)) != n_ctrl &&
339+ get_ctrl (m->in (AddPNode::Offset)) != n_ctrl) {
340+ // Move the AddP up to the dominating point. That's fine because control of m's inputs
341+ // must dominate get_ctrl(m) == n_ctrl and we just checked that the input controls are != n_ctrl.
340342 Node* c = find_non_split_ctrl (idom (n_ctrl));
341343 if (c->is_OuterStripMinedLoop ()) {
342344 c->as_Loop ()->verify_strip_mined (1 );
@@ -1603,6 +1605,8 @@ void PhaseIdealLoop::try_sink_out_of_loop(Node* n) {
16031605 }
16041606}
16051607
1608+ // Compute the early control of a node by following its inputs until we reach
1609+ // nodes that are pinned. Then compute the LCA of the control of all pinned nodes.
16061610Node* PhaseIdealLoop::compute_early_ctrl (Node* n, Node* n_ctrl) {
16071611 Node* early_ctrl = NULL ;
16081612 ResourceMark rm;
@@ -1618,17 +1622,14 @@ Node* PhaseIdealLoop::compute_early_ctrl(Node* n, Node* n_ctrl) {
16181622 } else {
16191623 for (uint j = 0 ; j < m->req (); j++) {
16201624 Node* in = m->in (j);
1621- if (in = = NULL ) {
1622- continue ;
1625+ if (in ! = NULL ) {
1626+ wq. push (in) ;
16231627 }
1624- wq.push (in);
16251628 }
16261629 }
16271630 if (c != NULL ) {
1628- assert (is_dominator (c, n_ctrl), " " );
1629- if (early_ctrl == NULL ) {
1630- early_ctrl = c;
1631- } else if (is_dominator (early_ctrl, c)) {
1631+ assert (is_dominator (c, n_ctrl), " control input must dominate current control" );
1632+ if (early_ctrl == NULL || is_dominator (early_ctrl, c)) {
16321633 early_ctrl = c;
16331634 }
16341635 }
0 commit comments