899 // Take steps to maximally unroll the loop. Peel any odd iterations, then
900 // unroll to do double iterations. The next round of major loop transforms
901 // will repeat till the doubled loop body does all remaining iterations in 1
902 // pass.
903 void do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new );
904
905 // Unroll the loop body one step - make each trip do 2 iterations.
906 void do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip );
907
908 // Mark vector reduction candidates before loop unrolling
909 void mark_reductions( IdealLoopTree *loop );
910
911 // Return true if exp is a constant times an induction var
912 bool is_scaled_iv(Node* exp, Node* iv, int* p_scale);
913
914 // Return true if exp is a scaled induction var plus (or minus) constant
915 bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
916
917 // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
918 ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
919 Deoptimization::DeoptReason reason);
920 void register_control(Node* n, IdealLoopTree *loop, Node* pred);
921
922 // Clone loop predicates to cloned loops (peeled, unswitched)
923 static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
924 Deoptimization::DeoptReason reason,
925 PhaseIdealLoop* loop_phase,
926 PhaseIterGVN* igvn);
927
928 static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
929 bool clone_limit_check,
930 PhaseIdealLoop* loop_phase,
931 PhaseIterGVN* igvn);
932 Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
933
934 static Node* skip_loop_predicates(Node* entry);
935
936 // Find a good location to insert a predicate
937 static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
938 // Find a predicate
939 static Node* find_predicate(Node* entry);
949 // Helper function to collect predicate for eliminating the useless ones
950 void collect_potentially_useful_predicates(IdealLoopTree *loop, Unique_Node_List &predicate_opaque1);
951 void eliminate_useless_predicates();
952
953 // Change the control input of expensive nodes to allow commoning by
954 // IGVN when it is guaranteed to not result in a more frequent
955 // execution of the expensive node. Return true if progress.
956 bool process_expensive_nodes();
957
958 // Check whether node has become unreachable
959 bool is_node_unreachable(Node *n) const {
960 return !has_node(n) || n->is_unreachable(_igvn);
961 }
962
963 // Eliminate range-checks and other trip-counter vs loop-invariant tests.
964 void do_range_check( IdealLoopTree *loop, Node_List &old_new );
965
966 // Create a slow version of the loop by cloning the loop
967 // and inserting an if to select fast-slow versions.
968 ProjNode* create_slow_version_of_loop(IdealLoopTree *loop,
969 Node_List &old_new);
970
971 // Clone a loop and return the clone head (clone_loop_head).
972 // Added nodes include int(1), int(0) - disconnected, If, IfTrue, IfFalse,
973 // This routine was created for usage in CountedLoopReserveKit.
974 //
975 // int(1) -> If -> IfTrue -> original_loop_head
976 // |
977 // V
978 // IfFalse -> clone_loop_head (returned by function pointer)
979 //
980 LoopNode* create_reserve_version_of_loop(IdealLoopTree *loop, CountedLoopReserveKit* lk);
981 // Clone loop with an invariant test (that does not exit) and
982 // insert a clone of the test that selects which version to
983 // execute.
984 void do_unswitching (IdealLoopTree *loop, Node_List &old_new);
985
986 // Find candidate "if" for unswitching
987 IfNode* find_unswitching_candidate(const IdealLoopTree *loop) const;
988
989 // Range Check Elimination uses this function!
|
899 // Take steps to maximally unroll the loop. Peel any odd iterations, then
900 // unroll to do double iterations. The next round of major loop transforms
901 // will repeat till the doubled loop body does all remaining iterations in 1
902 // pass.
903 void do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new );
904
905 // Unroll the loop body one step - make each trip do 2 iterations.
906 void do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip );
907
908 // Mark vector reduction candidates before loop unrolling
909 void mark_reductions( IdealLoopTree *loop );
910
911 // Return true if exp is a constant times an induction var
912 bool is_scaled_iv(Node* exp, Node* iv, int* p_scale);
913
914 // Return true if exp is a scaled induction var plus (or minus) constant
915 bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
916
917 // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
918 ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
919 Deoptimization::DeoptReason reason,
920 int opcode);
921 void register_control(Node* n, IdealLoopTree *loop, Node* pred);
922
923 // Clone loop predicates to cloned loops (peeled, unswitched)
924 static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
925 Deoptimization::DeoptReason reason,
926 PhaseIdealLoop* loop_phase,
927 PhaseIterGVN* igvn);
928
929 static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
930 bool clone_limit_check,
931 PhaseIdealLoop* loop_phase,
932 PhaseIterGVN* igvn);
933 Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
934
935 static Node* skip_loop_predicates(Node* entry);
936
937 // Find a good location to insert a predicate
938 static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
939 // Find a predicate
940 static Node* find_predicate(Node* entry);
950 // Helper function to collect predicate for eliminating the useless ones
951 void collect_potentially_useful_predicates(IdealLoopTree *loop, Unique_Node_List &predicate_opaque1);
952 void eliminate_useless_predicates();
953
954 // Change the control input of expensive nodes to allow commoning by
955 // IGVN when it is guaranteed to not result in a more frequent
956 // execution of the expensive node. Return true if progress.
957 bool process_expensive_nodes();
958
959 // Check whether node has become unreachable
960 bool is_node_unreachable(Node *n) const {
961 return !has_node(n) || n->is_unreachable(_igvn);
962 }
963
964 // Eliminate range-checks and other trip-counter vs loop-invariant tests.
965 void do_range_check( IdealLoopTree *loop, Node_List &old_new );
966
967 // Create a slow version of the loop by cloning the loop
968 // and inserting an if to select fast-slow versions.
969 ProjNode* create_slow_version_of_loop(IdealLoopTree *loop,
970 Node_List &old_new,
971 int opcode);
972
973 // Clone a loop and return the clone head (clone_loop_head).
974 // Added nodes include int(1), int(0) - disconnected, If, IfTrue, IfFalse,
975 // This routine was created for usage in CountedLoopReserveKit.
976 //
977 // int(1) -> If -> IfTrue -> original_loop_head
978 // |
979 // V
980 // IfFalse -> clone_loop_head (returned by function pointer)
981 //
982 LoopNode* create_reserve_version_of_loop(IdealLoopTree *loop, CountedLoopReserveKit* lk);
983 // Clone loop with an invariant test (that does not exit) and
984 // insert a clone of the test that selects which version to
985 // execute.
986 void do_unswitching (IdealLoopTree *loop, Node_List &old_new);
987
988 // Find candidate "if" for unswitching
989 IfNode* find_unswitching_candidate(const IdealLoopTree *loop) const;
990
991 // Range Check Elimination uses this function!
|