Skip to content

Commit

Permalink
Review Emanuel
Browse files Browse the repository at this point in the history
  • Loading branch information
chhagedorn committed Oct 28, 2024
1 parent eb22d38 commit 79a5913
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
14 changes: 7 additions & 7 deletions src/hotspot/share/opto/loopTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,8 @@ void PhaseIdealLoop::do_peeling(IdealLoopTree *loop, Node_List &old_new) {

// Step 5: Assertion Predicates initialization
if (counted_loop && UseLoopPredicate) {
initialize_assertion_predicates_for_peeled_loop(new_head->as_CountedLoop(), head->as_CountedLoop(),
first_node_index_in_cloned_loop_body, old_new);
initialize_assertion_predicates_for_peeled_loop(new_head->as_CountedLoop(), head->as_CountedLoop(),
first_node_index_in_cloned_loop_body, old_new);
}

// Now force out all loop-invariant dominating tests. The optimizer
Expand Down Expand Up @@ -1982,13 +1982,13 @@ void PhaseIdealLoop::create_assertion_predicates_at_loop(CountedLoopNode* source
Node* stride = target_loop_head->stride();
LoopNode* target_outer_loop_head = target_loop_head->skip_strip_mined();
Node* target_loop_entry = target_outer_loop_head->in(LoopNode::EntryControl);
AssertionPredicatesForLoop assertion_predicates_for_loop(init, stride, target_loop_entry, this,
_node_in_loop_body);
CreateAssertionPredicatesVisitor create_assertion_predicates_for_loop(init, stride, target_loop_entry, this,
_node_in_loop_body);
Node* source_loop_entry = source_loop_head->skip_strip_mined()->in(LoopNode::EntryControl);
PredicateIterator predicate_iterator(source_loop_entry);
predicate_iterator.for_each(assertion_predicates_for_loop);
if (assertion_predicates_for_loop.has_created_predicates()) {
IfTrueNode* last_created_predicate_success_proj = assertion_predicates_for_loop.last_created_success_proj();
predicate_iterator.for_each(create_assertion_predicates_for_loop);
if (create_assertion_predicates_for_loop.has_created_predicates()) {
IfTrueNode* last_created_predicate_success_proj = create_assertion_predicates_for_loop.last_created_success_proj();
_igvn.replace_input_of(target_outer_loop_head, LoopNode::EntryControl, last_created_predicate_success_proj);
set_idom(target_outer_loop_head, last_created_predicate_success_proj, dom_depth(target_outer_loop_head));
}
Expand Down
11 changes: 6 additions & 5 deletions src/hotspot/share/opto/predicates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,17 +728,18 @@ void Predicates::dump_for_loop(LoopNode* loop_node) {
}
#endif // NOT PRODUCT

// Keep track of the current Predicate Block by setting '_current_parse_predicate'.
void AssertionPredicatesForLoop::visit(const ParsePredicate& parse_predicate) {
// Keep track of whether we are in the correct Predicate Block where Template Assertion Predicates can be found.
// The PredicateIterator will always start at the loop entry and first visits the Loop Limit Check Predicate Block.
void CreateAssertionPredicatesVisitor::visit(const ParsePredicate& parse_predicate) {
Deoptimization::DeoptReason deopt_reason = parse_predicate.head()->deopt_reason();
if (deopt_reason == Deoptimization::Reason_predicate ||
deopt_reason == Deoptimization::Reason_profile_predicate) {
_current_parse_predicate = parse_predicate.tail();
_has_hoisted_check_parse_predicates = true;
}
}

void AssertionPredicatesForLoop::visit(const TemplateAssertionPredicate& template_assertion_predicate) {
if (_current_parse_predicate == nullptr) {
void CreateAssertionPredicatesVisitor::visit(const TemplateAssertionPredicate& template_assertion_predicate) {
if (!_has_hoisted_check_parse_predicates) {
// Only process if we are in the correct Predicate Block.
return;
}
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/opto/predicates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,26 +943,26 @@ class NodeInOriginalLoopBody : public NodeInLoopBody {

// Visitor to create Initialized Assertion Predicates at a target loop from Template Assertion Predicates from a source
// loop. This visitor can be used in combination with a PredicateIterator.
class AssertionPredicatesForLoop : public PredicateVisitor {
class CreateAssertionPredicatesVisitor : public PredicateVisitor {
Node* const _init;
Node* const _stride;
Node* const _old_target_loop_entry;
Node* _new_control;
PhaseIdealLoop* const _phase;
ParsePredicateSuccessProj* _current_parse_predicate;
bool _has_hoisted_check_parse_predicates;
const NodeInLoopBody& _node_in_loop_body;

public:
AssertionPredicatesForLoop(Node* init, Node* stride, Node* new_control, PhaseIdealLoop* phase,
const NodeInLoopBody& node_in_loop_body)
CreateAssertionPredicatesVisitor(Node* init, Node* stride, Node* new_control, PhaseIdealLoop* phase,
const NodeInLoopBody& node_in_loop_body)
: _init(init),
_stride(stride),
_old_target_loop_entry(new_control),
_new_control(new_control),
_phase(phase),
_current_parse_predicate(nullptr),
_has_hoisted_check_parse_predicates(false),
_node_in_loop_body(node_in_loop_body) {}
NONCOPYABLE(AssertionPredicatesForLoop);
NONCOPYABLE(CreateAssertionPredicatesVisitor);

using PredicateVisitor::visit;

Expand Down

0 comments on commit 79a5913

Please sign in to comment.