From 3efa77af0eb95c2fd8e68dad06648944401fd98f Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Thu, 23 Nov 2023 14:31:15 +0100 Subject: [PATCH] more cleanups --- src/hotspot/share/opto/cfgnode.cpp | 12 +++++++++++- src/hotspot/share/opto/cfgnode.hpp | 19 ++++++------------- src/hotspot/share/opto/loopPredicate.cpp | 4 ++-- src/hotspot/share/opto/loopnode.hpp | 4 ++-- src/hotspot/share/opto/loopopts.cpp | 4 ++-- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/hotspot/share/opto/cfgnode.cpp b/src/hotspot/share/opto/cfgnode.cpp index f8ffe054e1afb..948c1189c7846 100644 --- a/src/hotspot/share/opto/cfgnode.cpp +++ b/src/hotspot/share/opto/cfgnode.cpp @@ -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); diff --git a/src/hotspot/share/opto/cfgnode.hpp b/src/hotspot/share/opto/cfgnode.hpp index 6d1a9e9ff52c0..061d8ac85ce41 100644 --- a/src/hotspot/share/opto/cfgnode.hpp +++ b/src/hotspot/share/opto/cfgnode.hpp @@ -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" @@ -57,6 +56,7 @@ class CatchProjNode; class JProjNode; class JumpProjNode; class SCMemProjNode; +class OpaqueAssertionPredicateNode; class PhaseIdealLoop; enum class AssertionPredicateType; @@ -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; } @@ -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;) }; @@ -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); diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp index dbab17ecb6082..0be589128b8ba 100644 --- a/src/hotspot/share/opto/loopPredicate.cpp +++ b/src/hotspot/share/opto/loopPredicate.cpp @@ -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 diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 76812b19172db..fdd390975f7b3 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -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 @@ -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); }; diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index a34e525e5cf9d..17cac4a2c28ae 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -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. @@ -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)) {