2668 Node* use = phi->fast_out(i); // User of trip-counter
2669 if (!has_ctrl(use)) continue;
2670 Node *u_ctrl = get_ctrl(use);
2671 if( use->is_Phi() ) {
2672 u_ctrl = NULL;
2673 for( uint j = 1; j < use->req(); j++ )
2674 if( use->in(j) == phi )
2675 u_ctrl = dom_lca( u_ctrl, use->in(0)->in(j) );
2676 }
2677 IdealLoopTree *u_loop = get_loop(u_ctrl);
2678 // Look for loop-invariant use
2679 if( u_loop == loop ) continue;
2680 if( loop->is_member( u_loop ) ) continue;
2681 // Check that use is live out the bottom. Assuming the trip-counter
2682 // update is right at the bottom, uses of of the loop middle are ok.
2683 if( dom_lca( exit, u_ctrl ) != exit ) continue;
2684 // protect against stride not being a constant
2685 if( !cle->stride_is_con() ) continue;
2686 // Hit! Refactor use to use the post-incremented tripcounter.
2687 // Compute a post-increment tripcounter.
2688 Node *opaq = new (C, 2) Opaque2Node( cle->incr() );
2689 register_new_node( opaq, u_ctrl );
2690 Node *neg_stride = _igvn.intcon(-cle->stride_con());
2691 set_ctrl(neg_stride, C->root());
2692 Node *post = new (C, 3) AddINode( opaq, neg_stride);
2693 register_new_node( post, u_ctrl );
2694 _igvn.hash_delete(use);
2695 _igvn._worklist.push(use);
2696 for( uint j = 1; j < use->req(); j++ )
2697 if( use->in(j) == phi )
2698 use->set_req(j, post);
2699 // Since DU info changed, rerun loop
2700 progress = true;
2701 break;
2702 }
2703 }
2704
2705 }
|
2668 Node* use = phi->fast_out(i); // User of trip-counter
2669 if (!has_ctrl(use)) continue;
2670 Node *u_ctrl = get_ctrl(use);
2671 if( use->is_Phi() ) {
2672 u_ctrl = NULL;
2673 for( uint j = 1; j < use->req(); j++ )
2674 if( use->in(j) == phi )
2675 u_ctrl = dom_lca( u_ctrl, use->in(0)->in(j) );
2676 }
2677 IdealLoopTree *u_loop = get_loop(u_ctrl);
2678 // Look for loop-invariant use
2679 if( u_loop == loop ) continue;
2680 if( loop->is_member( u_loop ) ) continue;
2681 // Check that use is live out the bottom. Assuming the trip-counter
2682 // update is right at the bottom, uses of of the loop middle are ok.
2683 if( dom_lca( exit, u_ctrl ) != exit ) continue;
2684 // protect against stride not being a constant
2685 if( !cle->stride_is_con() ) continue;
2686 // Hit! Refactor use to use the post-incremented tripcounter.
2687 // Compute a post-increment tripcounter.
2688 Node *opaq = new (C, 2) Opaque2Node( C, cle->incr() );
2689 register_new_node( opaq, u_ctrl );
2690 Node *neg_stride = _igvn.intcon(-cle->stride_con());
2691 set_ctrl(neg_stride, C->root());
2692 Node *post = new (C, 3) AddINode( opaq, neg_stride);
2693 register_new_node( post, u_ctrl );
2694 _igvn.hash_delete(use);
2695 _igvn._worklist.push(use);
2696 for( uint j = 1; j < use->req(); j++ )
2697 if( use->in(j) == phi )
2698 use->set_req(j, post);
2699 // Since DU info changed, rerun loop
2700 progress = true;
2701 break;
2702 }
2703 }
2704
2705 }
|