< prev index next >

src/share/vm/opto/loopnode.hpp

Print this page




 104   int unswitch_max() { return _unswitch_max; }
 105   int unswitch_count() { return _unswitch_count; }
 106 
 107   int has_been_range_checked() const { return _postloop_flags & LoopRCEChecked; }
 108   void set_has_been_range_checked() { _postloop_flags |= LoopRCEChecked; }
 109   int is_rce_post_loop() const { return _postloop_flags & RCEPostLoop; }
 110   void set_is_rce_post_loop() { _postloop_flags |= RCEPostLoop; }
 111 
 112   void set_unswitch_count(int val) {
 113     assert (val <= unswitch_max(), "too many unswitches");
 114     _unswitch_count = val;
 115   }
 116 
 117   LoopNode(Node *entry, Node *backedge) : RegionNode(3), _loop_flags(0), _unswitch_count(0), _postloop_flags(0) {
 118     init_class_id(Class_Loop);
 119     init_req(EntryControl, entry);
 120     init_req(LoopBackControl, backedge);
 121   }
 122 
 123   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 124   virtual int Opcode() const;
 125   bool can_be_counted_loop(PhaseTransform* phase) const {
 126     return req() == 3 && in(0) != NULL &&
 127       in(1) != NULL && phase->type(in(1)) != Type::TOP &&
 128       in(2) != NULL && phase->type(in(2)) != Type::TOP;
 129   }
 130   bool is_valid_counted_loop() const;
 131 #ifndef PRODUCT
 132   virtual void dump_spec(outputStream *st) const;
 133 #endif
 134 };
 135 
 136 //------------------------------Counted Loops----------------------------------
 137 // Counted loops are all trip-counted loops, with exactly 1 trip-counter exit
 138 // path (and maybe some other exit paths).  The trip-counter exit is always
 139 // last in the loop.  The trip-counter have to stride by a constant;
 140 // the exit value is also loop invariant.
 141 
 142 // CountedLoopNodes and CountedLoopEndNodes come in matched pairs.  The
 143 // CountedLoopNode has the incoming loop control and the loop-back-control
 144 // which is always the IfTrue before the matching CountedLoopEndNode.  The


 181   int _unrolled_count_log2;
 182 
 183   // Node count prior to last unrolling - used to decide if
 184   // unroll,optimize,unroll,optimize,... is making progress
 185   int _node_count_before_unroll;
 186 
 187   // If slp analysis is performed we record the maximum
 188   // vector mapped unroll factor here
 189   int _slp_maximum_unroll_factor;
 190 
 191 public:
 192   CountedLoopNode( Node *entry, Node *backedge )
 193     : LoopNode(entry, backedge), _main_idx(0), _trip_count(max_juint),
 194       _profile_trip_cnt(COUNT_UNKNOWN), _unrolled_count_log2(0),
 195       _node_count_before_unroll(0), _slp_maximum_unroll_factor(0) {
 196     init_class_id(Class_CountedLoop);
 197     // Initialize _trip_count to the largest possible value.
 198     // Will be reset (lower) if the loop's trip count is known.
 199   }
 200 
 201   virtual int Opcode() const;
 202   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 203 
 204   Node *init_control() const { return in(EntryControl); }
 205   Node *back_control() const { return in(LoopBackControl); }
 206   CountedLoopEndNode *loopexit() const;
 207   Node *init_trip() const;
 208   Node *stride() const;
 209   int   stride_con() const;
 210   bool  stride_is_con() const;
 211   Node *limit() const;
 212   Node *incr() const;
 213   Node *phi() const;
 214 
 215   // Match increment with optional truncation
 216   static Node* match_incr_with_optional_truncation(Node* expr, Node** trunc1, Node** trunc2, const TypeInt** trunc_type);
 217 
 218   // A 'main' loop has a pre-loop and a post-loop.  The 'main' loop
 219   // can run short a few iterations and may start a few iterations in.
 220   // It will be RCE'd and unrolled and aligned.
 221 


 277   int  node_count_before_unroll()            { return _node_count_before_unroll; }
 278   void set_slp_max_unroll(int unroll_factor) { _slp_maximum_unroll_factor = unroll_factor; }
 279   int  slp_max_unroll() const                { return _slp_maximum_unroll_factor; }
 280 
 281 #ifndef PRODUCT
 282   virtual void dump_spec(outputStream *st) const;
 283 #endif
 284 };
 285 
 286 //------------------------------CountedLoopEndNode-----------------------------
 287 // CountedLoopEndNodes end simple trip counted loops.  They act much like
 288 // IfNodes.
 289 class CountedLoopEndNode : public IfNode {
 290 public:
 291   enum { TestControl, TestValue };
 292 
 293   CountedLoopEndNode( Node *control, Node *test, float prob, float cnt )
 294     : IfNode( control, test, prob, cnt) {
 295     init_class_id(Class_CountedLoopEnd);
 296   }
 297   virtual int Opcode() const;
 298 
 299   Node *cmp_node() const            { return (in(TestValue)->req() >=2) ? in(TestValue)->in(1) : NULL; }
 300   Node *incr() const                { Node *tmp = cmp_node(); return (tmp && tmp->req()==3) ? tmp->in(1) : NULL; }
 301   Node *limit() const               { Node *tmp = cmp_node(); return (tmp && tmp->req()==3) ? tmp->in(2) : NULL; }
 302   Node *stride() const              { Node *tmp = incr    (); return (tmp && tmp->req()==3) ? tmp->in(2) : NULL; }
 303   Node *init_trip() const           { Node *tmp = phi     (); return (tmp && tmp->req()==3) ? tmp->in(1) : NULL; }
 304   int stride_con() const;
 305   bool stride_is_con() const        { Node *tmp = stride  (); return (tmp != NULL && tmp->is_Con()); }
 306   BoolTest::mask test_trip() const  { return in(TestValue)->as_Bool()->_test._test; }
 307   PhiNode *phi() const {
 308     Node *tmp = incr();
 309     if (tmp && tmp->req() == 3) {
 310       Node* phi = tmp->in(1);
 311       if (phi->is_Phi()) {
 312         return phi->as_Phi();
 313       }
 314     }
 315     return NULL;
 316   }
 317   CountedLoopNode *loopnode() const {


 322     if (iv_phi == NULL) {
 323       return NULL;
 324     }
 325     Node *ln = iv_phi->in(0);
 326     if (ln->is_CountedLoop() && ln->as_CountedLoop()->loopexit() == this) {
 327       return (CountedLoopNode*)ln;
 328     }
 329     return NULL;
 330   }
 331 
 332 #ifndef PRODUCT
 333   virtual void dump_spec(outputStream *st) const;
 334 #endif
 335 };
 336 
 337 
 338 inline CountedLoopEndNode *CountedLoopNode::loopexit() const {
 339   Node *bc = back_control();
 340   if( bc == NULL ) return NULL;
 341   Node *le = bc->in(0);
 342   if( le->Opcode() != Op_CountedLoopEnd )
 343     return NULL;
 344   return (CountedLoopEndNode*)le;
 345 }
 346 inline Node *CountedLoopNode::init_trip() const { return loopexit() ? loopexit()->init_trip() : NULL; }
 347 inline Node *CountedLoopNode::stride() const { return loopexit() ? loopexit()->stride() : NULL; }
 348 inline int CountedLoopNode::stride_con() const { return loopexit() ? loopexit()->stride_con() : 0; }
 349 inline bool CountedLoopNode::stride_is_con() const { return loopexit() && loopexit()->stride_is_con(); }
 350 inline Node *CountedLoopNode::limit() const { return loopexit() ? loopexit()->limit() : NULL; }
 351 inline Node *CountedLoopNode::incr() const { return loopexit() ? loopexit()->incr() : NULL; }
 352 inline Node *CountedLoopNode::phi() const { return loopexit() ? loopexit()->phi() : NULL; }
 353 
 354 //------------------------------LoopLimitNode-----------------------------
 355 // Counted Loop limit node which represents exact final iterator value:
 356 // trip_count = (limit - init_trip + stride - 1)/stride
 357 // final_value= trip_count * stride + init_trip.
 358 // Use HW instructions to calculate it when it can overflow in integer.
 359 // Note, final_value should fit into integer since counted loop has
 360 // limit check: limit <= max_int-stride.
 361 class LoopLimitNode : public Node {
 362   enum { Init=1, Limit=2, Stride=3 };
 363  public:
 364   LoopLimitNode( Compile* C, Node *init, Node *limit, Node *stride ) : Node(0,init,limit,stride) {
 365     // Put it on the Macro nodes list to optimize during macro nodes expansion.
 366     init_flags(Flag_is_macro);
 367     C->add_macro_node(this);
 368   }
 369   virtual int Opcode() const;
 370   virtual const Type *bottom_type() const { return TypeInt::INT; }
 371   virtual uint ideal_reg() const { return Op_RegI; }
 372   virtual const Type* Value(PhaseGVN* phase) const;
 373   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 374   virtual Node* Identity(PhaseGVN* phase);
 375 };
 376 
 377 // -----------------------------IdealLoopTree----------------------------------
 378 class IdealLoopTree : public ResourceObj {
 379 public:
 380   IdealLoopTree *_parent;       // Parent in loop tree
 381   IdealLoopTree *_next;         // Next sibling in loop tree
 382   IdealLoopTree *_child;        // First child in loop tree
 383 
 384   // The head-tail backedge defines the loop.
 385   // If tail is NULL then this loop has multiple backedges as part of the
 386   // same loop.  During cleanup I'll peel off the multiple backedges; merge
 387   // them at the loop bottom and flow 1 real backedge into the loop.
 388   Node *_head;                  // Head of loop
 389   Node *_tail;                  // Tail of loop
 390   inline Node *tail();          // Handle lazy update of _tail field
 391   PhaseIdealLoop* _phase;


 942   // unroll to do double iterations.  The next round of major loop transforms
 943   // will repeat till the doubled loop body does all remaining iterations in 1
 944   // pass.
 945   void do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new );
 946 
 947   // Unroll the loop body one step - make each trip do 2 iterations.
 948   void do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip );
 949 
 950   // Mark vector reduction candidates before loop unrolling
 951   void mark_reductions( IdealLoopTree *loop );
 952 
 953   // Return true if exp is a constant times an induction var
 954   bool is_scaled_iv(Node* exp, Node* iv, int* p_scale);
 955 
 956   // Return true if exp is a scaled induction var plus (or minus) constant
 957   bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
 958 
 959   // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
 960   ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
 961                                         Deoptimization::DeoptReason reason,
 962                                         int opcode);
 963   void register_control(Node* n, IdealLoopTree *loop, Node* pred);
 964 
 965   // Clone loop predicates to cloned loops (peeled, unswitched)
 966   static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
 967                                    Deoptimization::DeoptReason reason,
 968                                    PhaseIdealLoop* loop_phase,
 969                                    PhaseIterGVN* igvn);
 970 
 971   static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
 972                                          bool clone_limit_check,
 973                                          PhaseIdealLoop* loop_phase,
 974                                          PhaseIterGVN* igvn);
 975   Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
 976 
 977   static Node* skip_loop_predicates(Node* entry);
 978 
 979   // Find a good location to insert a predicate
 980   static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
 981   // Find a predicate
 982   static Node* find_predicate(Node* entry);


1003     return !has_node(n) || n->is_unreachable(_igvn);
1004   }
1005 
1006   // Eliminate range-checks and other trip-counter vs loop-invariant tests.
1007   int do_range_check( IdealLoopTree *loop, Node_List &old_new );
1008 
1009   // Check to see if do_range_check(...) cleaned the main loop of range-checks
1010   void has_range_checks(IdealLoopTree *loop);
1011 
1012   // Process post loops which have range checks and try to build a multi-version
1013   // guard to safely determine if we can execute the post loop which was RCE'd.
1014   bool multi_version_post_loops(IdealLoopTree *rce_loop, IdealLoopTree *legacy_loop);
1015 
1016   // Cause the rce'd post loop to optimized away, this happens if we cannot complete multiverioning
1017   void poison_rce_post_loop(IdealLoopTree *rce_loop);
1018 
1019   // Create a slow version of the loop by cloning the loop
1020   // and inserting an if to select fast-slow versions.
1021   ProjNode* create_slow_version_of_loop(IdealLoopTree *loop,
1022                                         Node_List &old_new,
1023                                         int opcode);
1024 
1025   // Clone a loop and return the clone head (clone_loop_head).
1026   // Added nodes include int(1), int(0) - disconnected, If, IfTrue, IfFalse,
1027   // This routine was created for usage in CountedLoopReserveKit.
1028   //
1029   //    int(1) -> If -> IfTrue -> original_loop_head
1030   //              |
1031   //              V
1032   //           IfFalse -> clone_loop_head (returned by function pointer)
1033   //
1034   LoopNode* create_reserve_version_of_loop(IdealLoopTree *loop, CountedLoopReserveKit* lk);
1035   // Clone loop with an invariant test (that does not exit) and
1036   // insert a clone of the test that selects which version to
1037   // execute.
1038   void do_unswitching (IdealLoopTree *loop, Node_List &old_new);
1039 
1040   // Find candidate "if" for unswitching
1041   IfNode* find_unswitching_candidate(const IdealLoopTree *loop) const;
1042 
1043   // Range Check Elimination uses this function!




 104   int unswitch_max() { return _unswitch_max; }
 105   int unswitch_count() { return _unswitch_count; }
 106 
 107   int has_been_range_checked() const { return _postloop_flags & LoopRCEChecked; }
 108   void set_has_been_range_checked() { _postloop_flags |= LoopRCEChecked; }
 109   int is_rce_post_loop() const { return _postloop_flags & RCEPostLoop; }
 110   void set_is_rce_post_loop() { _postloop_flags |= RCEPostLoop; }
 111 
 112   void set_unswitch_count(int val) {
 113     assert (val <= unswitch_max(), "too many unswitches");
 114     _unswitch_count = val;
 115   }
 116 
 117   LoopNode(Node *entry, Node *backedge) : RegionNode(3), _loop_flags(0), _unswitch_count(0), _postloop_flags(0) {
 118     init_class_id(Class_Loop);
 119     init_req(EntryControl, entry);
 120     init_req(LoopBackControl, backedge);
 121   }
 122 
 123   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 124   virtual Opcodes Opcode() const;
 125   bool can_be_counted_loop(PhaseTransform* phase) const {
 126     return req() == 3 && in(0) != NULL &&
 127       in(1) != NULL && phase->type(in(1)) != Type::TOP &&
 128       in(2) != NULL && phase->type(in(2)) != Type::TOP;
 129   }
 130   bool is_valid_counted_loop() const;
 131 #ifndef PRODUCT
 132   virtual void dump_spec(outputStream *st) const;
 133 #endif
 134 };
 135 
 136 //------------------------------Counted Loops----------------------------------
 137 // Counted loops are all trip-counted loops, with exactly 1 trip-counter exit
 138 // path (and maybe some other exit paths).  The trip-counter exit is always
 139 // last in the loop.  The trip-counter have to stride by a constant;
 140 // the exit value is also loop invariant.
 141 
 142 // CountedLoopNodes and CountedLoopEndNodes come in matched pairs.  The
 143 // CountedLoopNode has the incoming loop control and the loop-back-control
 144 // which is always the IfTrue before the matching CountedLoopEndNode.  The


 181   int _unrolled_count_log2;
 182 
 183   // Node count prior to last unrolling - used to decide if
 184   // unroll,optimize,unroll,optimize,... is making progress
 185   int _node_count_before_unroll;
 186 
 187   // If slp analysis is performed we record the maximum
 188   // vector mapped unroll factor here
 189   int _slp_maximum_unroll_factor;
 190 
 191 public:
 192   CountedLoopNode( Node *entry, Node *backedge )
 193     : LoopNode(entry, backedge), _main_idx(0), _trip_count(max_juint),
 194       _profile_trip_cnt(COUNT_UNKNOWN), _unrolled_count_log2(0),
 195       _node_count_before_unroll(0), _slp_maximum_unroll_factor(0) {
 196     init_class_id(Class_CountedLoop);
 197     // Initialize _trip_count to the largest possible value.
 198     // Will be reset (lower) if the loop's trip count is known.
 199   }
 200 
 201   virtual Opcodes Opcode() const;
 202   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 203 
 204   Node *init_control() const { return in(EntryControl); }
 205   Node *back_control() const { return in(LoopBackControl); }
 206   CountedLoopEndNode *loopexit() const;
 207   Node *init_trip() const;
 208   Node *stride() const;
 209   int   stride_con() const;
 210   bool  stride_is_con() const;
 211   Node *limit() const;
 212   Node *incr() const;
 213   Node *phi() const;
 214 
 215   // Match increment with optional truncation
 216   static Node* match_incr_with_optional_truncation(Node* expr, Node** trunc1, Node** trunc2, const TypeInt** trunc_type);
 217 
 218   // A 'main' loop has a pre-loop and a post-loop.  The 'main' loop
 219   // can run short a few iterations and may start a few iterations in.
 220   // It will be RCE'd and unrolled and aligned.
 221 


 277   int  node_count_before_unroll()            { return _node_count_before_unroll; }
 278   void set_slp_max_unroll(int unroll_factor) { _slp_maximum_unroll_factor = unroll_factor; }
 279   int  slp_max_unroll() const                { return _slp_maximum_unroll_factor; }
 280 
 281 #ifndef PRODUCT
 282   virtual void dump_spec(outputStream *st) const;
 283 #endif
 284 };
 285 
 286 //------------------------------CountedLoopEndNode-----------------------------
 287 // CountedLoopEndNodes end simple trip counted loops.  They act much like
 288 // IfNodes.
 289 class CountedLoopEndNode : public IfNode {
 290 public:
 291   enum { TestControl, TestValue };
 292 
 293   CountedLoopEndNode( Node *control, Node *test, float prob, float cnt )
 294     : IfNode( control, test, prob, cnt) {
 295     init_class_id(Class_CountedLoopEnd);
 296   }
 297   virtual Opcodes Opcode() const;
 298 
 299   Node *cmp_node() const            { return (in(TestValue)->req() >=2) ? in(TestValue)->in(1) : NULL; }
 300   Node *incr() const                { Node *tmp = cmp_node(); return (tmp && tmp->req()==3) ? tmp->in(1) : NULL; }
 301   Node *limit() const               { Node *tmp = cmp_node(); return (tmp && tmp->req()==3) ? tmp->in(2) : NULL; }
 302   Node *stride() const              { Node *tmp = incr    (); return (tmp && tmp->req()==3) ? tmp->in(2) : NULL; }
 303   Node *init_trip() const           { Node *tmp = phi     (); return (tmp && tmp->req()==3) ? tmp->in(1) : NULL; }
 304   int stride_con() const;
 305   bool stride_is_con() const        { Node *tmp = stride  (); return (tmp != NULL && tmp->is_Con()); }
 306   BoolTest::mask test_trip() const  { return in(TestValue)->as_Bool()->_test._test; }
 307   PhiNode *phi() const {
 308     Node *tmp = incr();
 309     if (tmp && tmp->req() == 3) {
 310       Node* phi = tmp->in(1);
 311       if (phi->is_Phi()) {
 312         return phi->as_Phi();
 313       }
 314     }
 315     return NULL;
 316   }
 317   CountedLoopNode *loopnode() const {


 322     if (iv_phi == NULL) {
 323       return NULL;
 324     }
 325     Node *ln = iv_phi->in(0);
 326     if (ln->is_CountedLoop() && ln->as_CountedLoop()->loopexit() == this) {
 327       return (CountedLoopNode*)ln;
 328     }
 329     return NULL;
 330   }
 331 
 332 #ifndef PRODUCT
 333   virtual void dump_spec(outputStream *st) const;
 334 #endif
 335 };
 336 
 337 
 338 inline CountedLoopEndNode *CountedLoopNode::loopexit() const {
 339   Node *bc = back_control();
 340   if( bc == NULL ) return NULL;
 341   Node *le = bc->in(0);
 342   if( le->Opcode() != Opcodes::Op_CountedLoopEnd )
 343     return NULL;
 344   return (CountedLoopEndNode*)le;
 345 }
 346 inline Node *CountedLoopNode::init_trip() const { return loopexit() ? loopexit()->init_trip() : NULL; }
 347 inline Node *CountedLoopNode::stride() const { return loopexit() ? loopexit()->stride() : NULL; }
 348 inline int CountedLoopNode::stride_con() const { return loopexit() ? loopexit()->stride_con() : 0; }
 349 inline bool CountedLoopNode::stride_is_con() const { return loopexit() && loopexit()->stride_is_con(); }
 350 inline Node *CountedLoopNode::limit() const { return loopexit() ? loopexit()->limit() : NULL; }
 351 inline Node *CountedLoopNode::incr() const { return loopexit() ? loopexit()->incr() : NULL; }
 352 inline Node *CountedLoopNode::phi() const { return loopexit() ? loopexit()->phi() : NULL; }
 353 
 354 //------------------------------LoopLimitNode-----------------------------
 355 // Counted Loop limit node which represents exact final iterator value:
 356 // trip_count = (limit - init_trip + stride - 1)/stride
 357 // final_value= trip_count * stride + init_trip.
 358 // Use HW instructions to calculate it when it can overflow in integer.
 359 // Note, final_value should fit into integer since counted loop has
 360 // limit check: limit <= max_int-stride.
 361 class LoopLimitNode : public Node {
 362   enum { Init=1, Limit=2, Stride=3 };
 363  public:
 364   LoopLimitNode( Compile* C, Node *init, Node *limit, Node *stride ) : Node(0,init,limit,stride) {
 365     // Put it on the Macro nodes list to optimize during macro nodes expansion.
 366     init_flags(Flag_is_macro);
 367     C->add_macro_node(this);
 368   }
 369   virtual Opcodes Opcode() const;
 370   virtual const Type *bottom_type() const { return TypeInt::INT; }
 371   virtual Opcodes ideal_reg() const { return Opcodes::Op_RegI; }
 372   virtual const Type* Value(PhaseGVN* phase) const;
 373   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 374   virtual Node* Identity(PhaseGVN* phase);
 375 };
 376 
 377 // -----------------------------IdealLoopTree----------------------------------
 378 class IdealLoopTree : public ResourceObj {
 379 public:
 380   IdealLoopTree *_parent;       // Parent in loop tree
 381   IdealLoopTree *_next;         // Next sibling in loop tree
 382   IdealLoopTree *_child;        // First child in loop tree
 383 
 384   // The head-tail backedge defines the loop.
 385   // If tail is NULL then this loop has multiple backedges as part of the
 386   // same loop.  During cleanup I'll peel off the multiple backedges; merge
 387   // them at the loop bottom and flow 1 real backedge into the loop.
 388   Node *_head;                  // Head of loop
 389   Node *_tail;                  // Tail of loop
 390   inline Node *tail();          // Handle lazy update of _tail field
 391   PhaseIdealLoop* _phase;


 942   // unroll to do double iterations.  The next round of major loop transforms
 943   // will repeat till the doubled loop body does all remaining iterations in 1
 944   // pass.
 945   void do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new );
 946 
 947   // Unroll the loop body one step - make each trip do 2 iterations.
 948   void do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip );
 949 
 950   // Mark vector reduction candidates before loop unrolling
 951   void mark_reductions( IdealLoopTree *loop );
 952 
 953   // Return true if exp is a constant times an induction var
 954   bool is_scaled_iv(Node* exp, Node* iv, int* p_scale);
 955 
 956   // Return true if exp is a scaled induction var plus (or minus) constant
 957   bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
 958 
 959   // Create a new if above the uncommon_trap_if_pattern for the predicate to be promoted
 960   ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry,
 961                                         Deoptimization::DeoptReason reason,
 962                                         Opcodes opcode);
 963   void register_control(Node* n, IdealLoopTree *loop, Node* pred);
 964 
 965   // Clone loop predicates to cloned loops (peeled, unswitched)
 966   static ProjNode* clone_predicate(ProjNode* predicate_proj, Node* new_entry,
 967                                    Deoptimization::DeoptReason reason,
 968                                    PhaseIdealLoop* loop_phase,
 969                                    PhaseIterGVN* igvn);
 970 
 971   static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
 972                                          bool clone_limit_check,
 973                                          PhaseIdealLoop* loop_phase,
 974                                          PhaseIterGVN* igvn);
 975   Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
 976 
 977   static Node* skip_loop_predicates(Node* entry);
 978 
 979   // Find a good location to insert a predicate
 980   static ProjNode* find_predicate_insertion_point(Node* start_c, Deoptimization::DeoptReason reason);
 981   // Find a predicate
 982   static Node* find_predicate(Node* entry);


1003     return !has_node(n) || n->is_unreachable(_igvn);
1004   }
1005 
1006   // Eliminate range-checks and other trip-counter vs loop-invariant tests.
1007   int do_range_check( IdealLoopTree *loop, Node_List &old_new );
1008 
1009   // Check to see if do_range_check(...) cleaned the main loop of range-checks
1010   void has_range_checks(IdealLoopTree *loop);
1011 
1012   // Process post loops which have range checks and try to build a multi-version
1013   // guard to safely determine if we can execute the post loop which was RCE'd.
1014   bool multi_version_post_loops(IdealLoopTree *rce_loop, IdealLoopTree *legacy_loop);
1015 
1016   // Cause the rce'd post loop to optimized away, this happens if we cannot complete multiverioning
1017   void poison_rce_post_loop(IdealLoopTree *rce_loop);
1018 
1019   // Create a slow version of the loop by cloning the loop
1020   // and inserting an if to select fast-slow versions.
1021   ProjNode* create_slow_version_of_loop(IdealLoopTree *loop,
1022                                         Node_List &old_new,
1023                                         Opcodes opcode);
1024 
1025   // Clone a loop and return the clone head (clone_loop_head).
1026   // Added nodes include int(1), int(0) - disconnected, If, IfTrue, IfFalse,
1027   // This routine was created for usage in CountedLoopReserveKit.
1028   //
1029   //    int(1) -> If -> IfTrue -> original_loop_head
1030   //              |
1031   //              V
1032   //           IfFalse -> clone_loop_head (returned by function pointer)
1033   //
1034   LoopNode* create_reserve_version_of_loop(IdealLoopTree *loop, CountedLoopReserveKit* lk);
1035   // Clone loop with an invariant test (that does not exit) and
1036   // insert a clone of the test that selects which version to
1037   // execute.
1038   void do_unswitching (IdealLoopTree *loop, Node_List &old_new);
1039 
1040   // Find candidate "if" for unswitching
1041   IfNode* find_unswitching_candidate(const IdealLoopTree *loop) const;
1042 
1043   // Range Check Elimination uses this function!


< prev index next >