Skip to content

Commit

Permalink
more cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
chhagedorn committed Nov 23, 2023
1 parent 764e1a1 commit 3efa77a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
12 changes: 11 additions & 1 deletion src/hotspot/share/opto/cfgnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2840,13 +2840,23 @@ IfNode* TemplateAssertionPredicateNode::create_initialized_assertion_predicate(
create_if_node = _initialized_last_value_opcode == Op_If;
break;
default:
assert(false, "should not reach");
assert(false, "invalid Assertion Predicate type");
}
return create_if_node ?
new IfNode(control, opaque_bool, PROB_MAX, COUNT_UNKNOWN NOT_PRODUCT(COMMA initialized_assertion_predicate_type)) :
new RangeCheckNode(control, opaque_bool, PROB_MAX, COUNT_UNKNOWN NOT_PRODUCT(COMMA initialized_assertion_predicate_type));
}


uint TemplateAssertionPredicateNode::index_for_bool_input(const BoolNode* bool_input) const {
if (bool_input == in(TemplateAssertionPredicateNode::InitValue)) {
return TemplateAssertionPredicateNode::InitValue;
} else {
assert(bool_input == in(TemplateAssertionPredicateNode::LastValue), "must be a bool input");
return TemplateAssertionPredicateNode::LastValue;
}
}

Node* TemplateAssertionPredicateNode::Identity(PhaseGVN* phase) {
if (phase->C->post_loop_opts_phase() || _useless) {
return in(0);
Expand Down
19 changes: 6 additions & 13 deletions src/hotspot/share/opto/cfgnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#ifndef SHARE_OPTO_CFGNODE_HPP
#define SHARE_OPTO_CFGNODE_HPP

#include "opaquenode.hpp"
#include "opto/multnode.hpp"
#include "opto/node.hpp"
#include "opto/opcodes.hpp"
Expand Down Expand Up @@ -57,6 +56,7 @@ class CatchProjNode;
class JProjNode;
class JumpProjNode;
class SCMemProjNode;
class OpaqueAssertionPredicateNode;
class PhaseIdealLoop;
enum class AssertionPredicateType;

Expand Down Expand Up @@ -309,13 +309,15 @@ class TemplateAssertionPredicateNode : public Node {

TemplateAssertionPredicateNode(Node* control, BoolNode* bool_init_value, BoolNode* bool_last_value,
int initialized_init_value_opcode, int initialized_last_value_opcode);
IfNode* create_initialized_assertion_predicate(Node* control, OpaqueAssertionPredicateNode* opaque_bool,
AssertionPredicateType initialized_assertion_predicate_type) const;

void mark_useless() {
_useless = true;
}

IfNode* create_initialized_assertion_predicate(Node* control, OpaqueAssertionPredicateNode* opaque_bool,
AssertionPredicateType initialized_assertion_predicate_type) const;
uint index_for_bool_input(const BoolNode* bool_input) const;

virtual int Opcode() const;
virtual bool pinned() const { return true; }
virtual bool is_CFG() const { return true; }
Expand All @@ -325,15 +327,6 @@ class TemplateAssertionPredicateNode : public Node {
virtual Node* Identity(PhaseGVN* phase);
virtual const Type* Value(PhaseGVN* phase) const;

uint index_for_bool_input(const BoolNode* bool_input) const {
if (bool_input == in(TemplateAssertionPredicateNode::InitValue)) {
return TemplateAssertionPredicateNode::InitValue;
} else {
assert(bool_input == in(TemplateAssertionPredicateNode::LastValue), "must be a bool input");
return TemplateAssertionPredicateNode::LastValue;
}
}

NOT_PRODUCT(void dump_spec(outputStream* st) const;)
};

Expand Down Expand Up @@ -371,7 +364,7 @@ class IfNode : public MultiBranchNode {
float _fcnt; // Frequency counter

private:
AssertionPredicateType _assertion_predicate_type;
NOT_PRODUCT(AssertionPredicateType _assertion_predicate_type;)

void init_node(Node* control, Node* bol) {
init_class_id(Class_If);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/loopPredicate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1127,11 +1127,11 @@ bool PhaseIdealLoop::loop_predication_impl_helper(IdealLoopTree* loop, IfProjNod
}

void PhaseIdealLoop::eliminate_old_range_check(IfProjNode* if_proj,
TemplateAssertionPredicateNode* template_assertion_predicate_node) {
TemplateAssertionPredicateNode* template_assertion_predicate) {
ConINode* true_con = _igvn.intcon(1);
set_ctrl(true_con, C->root());
_igvn.replace_input_of(if_proj->in(0), 1, true_con);
rewire_safe_outputs_to_dominator(if_proj, template_assertion_predicate_node);
rewire_safe_outputs_to_dominator(if_proj, template_assertion_predicate);
}

// Insert Hoisted Check Predicates for null checks and range checks and additional Template Assertion Predicates for
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/loopnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ class PhaseIdealLoop : public PhaseTransform {
Node *has_local_phi_input( Node *n );
// Mark an IfNode as being dominated by a prior test,
// without actually altering the CFG (and hence IDOM info).
void dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip = false, bool exclude_loop_predicate = false);
void dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip = false, bool exclude_predicates = false);
void rewire_safe_outputs_to_dominator(Node* source, Node* dominator);

// Split Node 'n' through merge point
Expand Down Expand Up @@ -1689,7 +1689,7 @@ class PhaseIdealLoop : public PhaseTransform {

bool can_move_to_inner_loop(Node* n, LoopNode* n_loop, Node* x);
void eliminate_old_range_check(IfProjNode* if_proj,
TemplateAssertionPredicateNode* template_assertion_predicate_node);
TemplateAssertionPredicateNode* template_assertion_predicate);
};


Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/opto/loopopts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ bool PhaseIdealLoop::loop_phi_backedge_type_contains_zero(const Node* phi_diviso
// Replace the dominated test with an obvious true or false. Place it on the
// IGVN worklist for later cleanup. Move control-dependent data Nodes on the
// live path up to the dominating control.
void PhaseIdealLoop::dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip, bool exclude_loop_predicate) {
void PhaseIdealLoop::dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip, bool exclude_predicates) {
if (VerifyLoopOptimizations && PrintOpto) { tty->print_cr("dominating test"); }

// prevdom is the dominating projection of the dominating test.
Expand Down Expand Up @@ -349,7 +349,7 @@ void PhaseIdealLoop::dominated_by(IfProjNode* prevdom, IfNode* iff, bool flip, b

ProjNode* dp_proj = dp->as_Proj();
ProjNode* unc_proj = iff->proj_out(1 - dp_proj->_con)->as_Proj();
if (exclude_loop_predicate &&
if (exclude_predicates &&
(unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != nullptr ||
unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_profile_predicate) != nullptr ||
unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_range_check) != nullptr)) {
Expand Down

0 comments on commit 3efa77a

Please sign in to comment.