860 // Return true if exp is a scaled induction var plus (or minus) constant
861 bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
862
863 // Return true if proj is for "proj->[region->..]call_uct"
864 static bool is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason);
865 // Return true for "if(test)-> proj -> ...
866 // |
867 // V
868 // other_proj->[region->..]call_uct"
869 static bool is_uncommon_trap_if_pattern(ProjNode* proj, Deoptimization::DeoptReason reason);
870 // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
871 ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
872 Deoptimization::DeoptReason reason);
873 void register_control(Node* n, IdealLoopTree *loop, Node* pred);
874
875 // Clone loop predicates to cloned loops (peeled, unswitched)
876 static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
877 Deoptimization::DeoptReason reason,
878 PhaseIdealLoop* loop_phase,
879 PhaseIterGVN* igvn);
880 static ProjNode* move_predicate(ProjNode* predicate_proj, Node* new_entry,
881 Deoptimization::DeoptReason reason,
882 PhaseIdealLoop* loop_phase,
883 PhaseIterGVN* igvn);
884 static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
885 bool move_predicates,
886 bool clone_limit_check,
887 PhaseIdealLoop* loop_phase,
888 PhaseIterGVN* igvn);
889 Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
890 Node* move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
891
892 void eliminate_loop_predicates(Node* entry);
893 static Node* skip_loop_predicates(Node* entry);
894
895 // Find a good location to insert a predicate
896 static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
897 // Find a predicate
898 static Node* find_predicate(Node* entry);
899 // Construct a range check for a predicate if
900 BoolNode* rc_predicate(IdealLoopTree *loop, Node* ctrl,
901 int scale, Node* offset,
902 Node* init, Node* limit, Node* stride,
903 Node* range, bool upper);
904
905 // Implementation of the loop predication to promote checks outside the loop
906 bool loop_predication_impl(IdealLoopTree *loop);
907
908 // Helper function to collect predicate for eliminating the useless ones
909 void collect_potentially_useful_predicates(IdealLoopTree *loop, Unique_Node_List &predicate_opaque1);
910 void eliminate_useless_predicates();
911
912 // Eliminate range-checks and other trip-counter vs loop-invariant tests.
|
860 // Return true if exp is a scaled induction var plus (or minus) constant
861 bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
862
863 // Return true if proj is for "proj->[region->..]call_uct"
864 static bool is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason);
865 // Return true for "if(test)-> proj -> ...
866 // |
867 // V
868 // other_proj->[region->..]call_uct"
869 static bool is_uncommon_trap_if_pattern(ProjNode* proj, Deoptimization::DeoptReason reason);
870 // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
871 ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
872 Deoptimization::DeoptReason reason);
873 void register_control(Node* n, IdealLoopTree *loop, Node* pred);
874
875 // Clone loop predicates to cloned loops (peeled, unswitched)
876 static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
877 Deoptimization::DeoptReason reason,
878 PhaseIdealLoop* loop_phase,
879 PhaseIterGVN* igvn);
880
881 static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
882 bool clone_limit_check,
883 PhaseIdealLoop* loop_phase,
884 PhaseIterGVN* igvn);
885 Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
886
887 static Node* skip_loop_predicates(Node* entry);
888
889 // Find a good location to insert a predicate
890 static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
891 // Find a predicate
892 static Node* find_predicate(Node* entry);
893 // Construct a range check for a predicate if
894 BoolNode* rc_predicate(IdealLoopTree *loop, Node* ctrl,
895 int scale, Node* offset,
896 Node* init, Node* limit, Node* stride,
897 Node* range, bool upper);
898
899 // Implementation of the loop predication to promote checks outside the loop
900 bool loop_predication_impl(IdealLoopTree *loop);
901
902 // Helper function to collect predicate for eliminating the useless ones
903 void collect_potentially_useful_predicates(IdealLoopTree *loop, Unique_Node_List &predicate_opaque1);
904 void eliminate_useless_predicates();
905
906 // Eliminate range-checks and other trip-counter vs loop-invariant tests.
|