src/hotspot/share/opto/loopPredicate.cpp
changeset 48145 f913f6dba2d3
parent 47216 71c04702a3d5
child 49487 bde392011cd8
equal deleted inserted replaced
48144:364207a23251 48145:f913f6dba2d3
   513   Invariance(Arena* area, IdealLoopTree* lpt) :
   513   Invariance(Arena* area, IdealLoopTree* lpt) :
   514     _lpt(lpt), _phase(lpt->_phase),
   514     _lpt(lpt), _phase(lpt->_phase),
   515     _visited(area), _invariant(area), _stack(area, 10 /* guess */),
   515     _visited(area), _invariant(area), _stack(area, 10 /* guess */),
   516     _clone_visited(area), _old_new(area)
   516     _clone_visited(area), _old_new(area)
   517   {
   517   {
   518     Node* head = _lpt->_head;
   518     LoopNode* head = _lpt->_head->as_Loop();
   519     Node* entry = head->in(LoopNode::EntryControl);
   519     Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl);
   520     if (entry->outcnt() != 1) {
   520     if (entry->outcnt() != 1) {
   521       // If a node is pinned between the predicates and the loop
   521       // If a node is pinned between the predicates and the loop
   522       // entry, we won't be able to move any node in the loop that
   522       // entry, we won't be able to move any node in the loop that
   523       // depends on it above it in a predicate. Mark all those nodes
   523       // depends on it above it in a predicate. Mark all those nodes
   524       // as non loop invariatnt.
   524       // as non loop invariatnt.
   799   if (head->unique_ctrl_out()->Opcode() == Op_NeverBranch) {
   799   if (head->unique_ctrl_out()->Opcode() == Op_NeverBranch) {
   800     // do nothing for infinite loops
   800     // do nothing for infinite loops
   801     return false;
   801     return false;
   802   }
   802   }
   803 
   803 
       
   804   if (head->is_OuterStripMinedLoop()) {
       
   805     return false;
       
   806   }
       
   807 
   804   CountedLoopNode *cl = NULL;
   808   CountedLoopNode *cl = NULL;
   805   if (head->is_valid_counted_loop()) {
   809   if (head->is_valid_counted_loop()) {
   806     cl = head->as_CountedLoop();
   810     cl = head->as_CountedLoop();
   807     // do nothing for iteration-splitted loops
   811     // do nothing for iteration-splitted loops
   808     if (!cl->is_normal_loop()) return false;
   812     if (!cl->is_normal_loop()) return false;
   810     BoolTest::mask bt = cl->loopexit()->test_trip();
   814     BoolTest::mask bt = cl->loopexit()->test_trip();
   811     if (bt != BoolTest::lt && bt != BoolTest::gt)
   815     if (bt != BoolTest::lt && bt != BoolTest::gt)
   812       cl = NULL;
   816       cl = NULL;
   813   }
   817   }
   814 
   818 
   815   Node* entry = head->in(LoopNode::EntryControl);
   819   Node* entry = head->skip_strip_mined()->in(LoopNode::EntryControl);
   816   ProjNode *predicate_proj = NULL;
   820   ProjNode *predicate_proj = NULL;
   817   // Loop limit check predicate should be near the loop.
   821   // Loop limit check predicate should be near the loop.
   818   predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check);
   822   predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check);
   819   if (predicate_proj != NULL)
   823   if (predicate_proj != NULL)
   820     entry = predicate_proj->in(0)->in(0);
   824     entry = predicate_proj->in(0)->in(0);
  1005     tty->print("Loop Predication Performed:");
  1009     tty->print("Loop Predication Performed:");
  1006     loop->dump_head();
  1010     loop->dump_head();
  1007   }
  1011   }
  1008 #endif
  1012 #endif
  1009 
  1013 
       
  1014   head->verify_strip_mined(1);
       
  1015 
  1010   return hoisted;
  1016   return hoisted;
  1011 }
  1017 }
  1012 
  1018 
  1013 //------------------------------loop_predication--------------------------------
  1019 //------------------------------loop_predication--------------------------------
  1014 // driver routine for loop predication optimization
  1020 // driver routine for loop predication optimization