@@ -812,7 +812,7 @@ void PhaseIdealLoop::do_peeling(IdealLoopTree *loop, Node_List &old_new) {
812
812
}
813
813
814
814
// Step 5: Assertion Predicates initialization
815
- if (counted_loop && UseLoopPredicate ) {
815
+ if (counted_loop) {
816
816
initialize_assertion_predicates_for_peeled_loop (new_head->as_CountedLoop (), head->as_CountedLoop (),
817
817
first_node_index_in_post_loop_body, old_new);
818
818
}
@@ -1450,11 +1450,9 @@ void PhaseIdealLoop::insert_pre_post_loops(IdealLoopTree *loop, Node_List &old_n
1450
1450
DEBUG_ONLY (const uint last_node_index_from_backedge_goo = Compile::current ()->unique () - 1 );
1451
1451
1452
1452
DEBUG_ONLY (ensure_zero_trip_guard_proj (outer_main_head->in (LoopNode::EntryControl), true );)
1453
- if (UseLoopPredicate) {
1454
- initialize_assertion_predicates_for_main_loop (pre_head, main_head, first_node_index_in_pre_loop_body,
1455
- last_node_index_in_pre_loop_body,
1456
- DEBUG_ONLY (last_node_index_from_backedge_goo COMMA) old_new);
1457
- }
1453
+ initialize_assertion_predicates_for_main_loop (pre_head, main_head, first_node_index_in_pre_loop_body,
1454
+ last_node_index_in_pre_loop_body,
1455
+ DEBUG_ONLY (last_node_index_from_backedge_goo COMMA) old_new);
1458
1456
1459
1457
// Step B4: Shorten the pre-loop to run only 1 iteration (for now).
1460
1458
// RCE and alignment may change this later.
@@ -1683,9 +1681,7 @@ Node *PhaseIdealLoop::insert_post_loop(IdealLoopTree* loop, Node_List& old_new,
1683
1681
}
1684
1682
1685
1683
DEBUG_ONLY (ensure_zero_trip_guard_proj (post_head->in (LoopNode::EntryControl), false );)
1686
- if (UseLoopPredicate) {
1687
- initialize_assertion_predicates_for_post_loop (main_head, post_head, first_node_index_in_cloned_loop_body);
1688
- }
1684
+ initialize_assertion_predicates_for_post_loop (main_head, post_head, first_node_index_in_cloned_loop_body);
1689
1685
return new_main_exit;
1690
1686
}
1691
1687
@@ -1719,7 +1715,7 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_peeled_loop(CountedLoop
1719
1715
const uint first_node_index_in_cloned_loop_body,
1720
1716
const Node_List& old_new) {
1721
1717
const NodeInOriginalLoopBody node_in_original_loop_body (first_node_index_in_cloned_loop_body, old_new);
1722
- create_assertion_predicates_at_loop (peeled_loop_head, remaining_loop_head, node_in_original_loop_body, false );
1718
+ create_assertion_predicates_at_loop (peeled_loop_head, remaining_loop_head, node_in_original_loop_body, true );
1723
1719
}
1724
1720
1725
1721
// Source Loop: Cloned - pre_loop_head
@@ -1739,6 +1735,9 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_main_loop(CountedLoopNo
1739
1735
1740
1736
// Source Loop: Original - main_loop_head
1741
1737
// Target Loop: Cloned - post_loop_head
1738
+ //
1739
+ // The post loop is cloned before the pre loop. Do not kill the old Template Assertion Predicates, yet. We need to clone
1740
+ // from them when creating the pre loop. Only then we can kill them.
1742
1741
void PhaseIdealLoop::initialize_assertion_predicates_for_post_loop (CountedLoopNode* main_loop_head,
1743
1742
CountedLoopNode* post_loop_head,
1744
1743
const uint first_node_index_in_cloned_loop_body) {
@@ -1749,9 +1748,9 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_post_loop(CountedLoopNo
1749
1748
void PhaseIdealLoop::create_assertion_predicates_at_loop (CountedLoopNode* source_loop_head,
1750
1749
CountedLoopNode* target_loop_head,
1751
1750
const NodeInLoopBody& _node_in_loop_body,
1752
- const bool clone_template ) {
1751
+ const bool kill_old_template ) {
1753
1752
CreateAssertionPredicatesVisitor create_assertion_predicates_visitor (target_loop_head, this , _node_in_loop_body,
1754
- clone_template );
1753
+ kill_old_template );
1755
1754
Node* source_loop_entry = source_loop_head->skip_strip_mined ()->in (LoopNode::EntryControl);
1756
1755
PredicateIterator predicate_iterator (source_loop_entry);
1757
1756
predicate_iterator.for_each (create_assertion_predicates_visitor);
@@ -1760,11 +1759,11 @@ void PhaseIdealLoop::create_assertion_predicates_at_loop(CountedLoopNode* source
1760
1759
void PhaseIdealLoop::create_assertion_predicates_at_main_or_post_loop (CountedLoopNode* source_loop_head,
1761
1760
CountedLoopNode* target_loop_head,
1762
1761
const NodeInLoopBody& _node_in_loop_body,
1763
- bool clone_template ) {
1762
+ const bool kill_old_template ) {
1764
1763
Node* old_target_loop_head_entry = target_loop_head->skip_strip_mined ()->in (LoopNode::EntryControl);
1765
1764
const uint node_index_before_new_assertion_predicate_nodes = C->unique ();
1766
1765
const bool need_to_rewire_old_target_loop_entry_dependencies = old_target_loop_head_entry->outcnt () > 1 ;
1767
- create_assertion_predicates_at_loop (source_loop_head, target_loop_head, _node_in_loop_body, clone_template );
1766
+ create_assertion_predicates_at_loop (source_loop_head, target_loop_head, _node_in_loop_body, kill_old_template );
1768
1767
if (need_to_rewire_old_target_loop_entry_dependencies) {
1769
1768
rewire_old_target_loop_entry_dependency_to_new_entry (target_loop_head, old_target_loop_head_entry,
1770
1769
node_index_before_new_assertion_predicate_nodes);
0 commit comments