860 void insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_new, bool peel_only );
861 // If Node n lives in the back_ctrl block, we clone a private version of n
862 // in preheader_ctrl block and return that, otherwise return n.
863 Node *clone_up_backedge_goo( Node *back_ctrl, Node *preheader_ctrl, Node *n, VectorSet &visited, Node_Stack &clones );
864
865 // Take steps to maximally unroll the loop. Peel any odd iterations, then
866 // unroll to do double iterations. The next round of major loop transforms
867 // will repeat till the doubled loop body does all remaining iterations in 1
868 // pass.
869 void do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new );
870
871 // Unroll the loop body one step - make each trip do 2 iterations.
872 void do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip );
873
874 // Return true if exp is a constant times an induction var
875 bool is_scaled_iv(Node* exp, Node* iv, int* p_scale);
876
877 // Return true if exp is a scaled induction var plus (or minus) constant
878 bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
879
880 // Return true if proj is for "proj->[region->..]call_uct"
881 static bool is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason);
882 // Return true for "if(test)-> proj -> ...
883 // |
884 // V
885 // other_proj->[region->..]call_uct"
886 static bool is_uncommon_trap_if_pattern(ProjNode* proj, Deoptimization::DeoptReason reason);
887 // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
888 ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
889 Deoptimization::DeoptReason reason);
890 void register_control(Node* n, IdealLoopTree *loop, Node* pred);
891
892 // Clone loop predicates to cloned loops (peeled, unswitched)
893 static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
894 Deoptimization::DeoptReason reason,
895 PhaseIdealLoop* loop_phase,
896 PhaseIterGVN* igvn);
897
898 static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
899 bool clone_limit_check,
900 PhaseIdealLoop* loop_phase,
901 PhaseIterGVN* igvn);
902 Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
903
904 static Node* skip_loop_predicates(Node* entry);
905
906 // Find a good location to insert a predicate
907 static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
908 // Find a predicate
909 static Node* find_predicate(Node* entry);
910 // Construct a range check for a predicate if
911 BoolNode* rc_predicate(IdealLoopTree *loop, Node* ctrl,
912 int scale, Node* offset,
913 Node* init, Node* limit, Node* stride,
914 Node* range, bool upper);
915
916 // Implementation of the loop predication to promote checks outside the loop
917 bool loop_predication_impl(IdealLoopTree *loop);
918
919 // Helper function to collect predicate for eliminating the useless ones
920 void collect_potentially_useful_predicates(IdealLoopTree *loop, Unique_Node_List &predicate_opaque1);
921 void eliminate_useless_predicates();
922
923 // Change the control input of expensive nodes to allow commoning by
924 // IGVN when it is guaranteed to not result in a more frequent
925 // execution of the expensive node. Return true if progress.
926 bool process_expensive_nodes();
927
928 // Check whether node has become unreachable
929 bool is_node_unreachable(Node *n) const {
930 return !has_node(n) || n->is_unreachable(_igvn);
931 }
932
933 // Eliminate range-checks and other trip-counter vs loop-invariant tests.
934 void do_range_check( IdealLoopTree *loop, Node_List &old_new );
|
860 void insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_new, bool peel_only );
861 // If Node n lives in the back_ctrl block, we clone a private version of n
862 // in preheader_ctrl block and return that, otherwise return n.
863 Node *clone_up_backedge_goo( Node *back_ctrl, Node *preheader_ctrl, Node *n, VectorSet &visited, Node_Stack &clones );
864
865 // Take steps to maximally unroll the loop. Peel any odd iterations, then
866 // unroll to do double iterations. The next round of major loop transforms
867 // will repeat till the doubled loop body does all remaining iterations in 1
868 // pass.
869 void do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new );
870
871 // Unroll the loop body one step - make each trip do 2 iterations.
872 void do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip );
873
874 // Return true if exp is a constant times an induction var
875 bool is_scaled_iv(Node* exp, Node* iv, int* p_scale);
876
877 // Return true if exp is a scaled induction var plus (or minus) constant
878 bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
879
880 // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
881 ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
882 Deoptimization::DeoptReason reason);
883 void register_control(Node* n, IdealLoopTree *loop, Node* pred);
884
885 // Clone loop predicates to cloned loops (peeled, unswitched)
886 static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
887 Deoptimization::DeoptReason reason,
888 PhaseIdealLoop* loop_phase,
889 PhaseIterGVN* igvn);
890
891 static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
892 bool clone_limit_check,
893 PhaseIdealLoop* loop_phase,
894 PhaseIterGVN* igvn);
895 Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
896
897 static Node* skip_loop_predicates(Node* entry);
898
899 // Find a good location to insert a predicate
900 static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
901 // Find a predicate
902 static Node* find_predicate(Node* entry);
903 // Construct a range check for a predicate if
904 BoolNode* rc_predicate(IdealLoopTree *loop, Node* ctrl,
905 int scale, Node* offset,
906 Node* init, Node* limit, jint stride,
907 Node* range, bool upper, bool &overflow);
908
909 // Implementation of the loop predication to promote checks outside the loop
910 bool loop_predication_impl(IdealLoopTree *loop);
911
912 // Helper function to collect predicate for eliminating the useless ones
913 void collect_potentially_useful_predicates(IdealLoopTree *loop, Unique_Node_List &predicate_opaque1);
914 void eliminate_useless_predicates();
915
916 // Change the control input of expensive nodes to allow commoning by
917 // IGVN when it is guaranteed to not result in a more frequent
918 // execution of the expensive node. Return true if progress.
919 bool process_expensive_nodes();
920
921 // Check whether node has become unreachable
922 bool is_node_unreachable(Node *n) const {
923 return !has_node(n) || n->is_unreachable(_igvn);
924 }
925
926 // Eliminate range-checks and other trip-counter vs loop-invariant tests.
927 void do_range_check( IdealLoopTree *loop, Node_List &old_new );
|