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); |