From 3a240df84f9eb84b432683c7b86202208277586b Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Thu, 16 Nov 2023 14:04:34 +0100 Subject: [PATCH] Misc cleanups --- src/hotspot/share/opto/cfgnode.hpp | 7 ++++--- src/hotspot/share/opto/loopPredicate.cpp | 18 ++++++++++-------- src/hotspot/share/opto/loopUnswitch.cpp | 7 ++----- src/hotspot/share/opto/loopnode.hpp | 1 - src/hotspot/share/opto/predicates.cpp | 6 +++--- .../predicates/TestAssertionPredicates.java | 1 - 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/hotspot/share/opto/cfgnode.hpp b/src/hotspot/share/opto/cfgnode.hpp index 52fea12b66f8c..03faec5807d9e 100644 --- a/src/hotspot/share/opto/cfgnode.hpp +++ b/src/hotspot/share/opto/cfgnode.hpp @@ -291,7 +291,7 @@ class GotoNode : public Node { virtual const RegMask &out_RegMask() const; }; -// This node represents a Template Assertion Predicate with two bools as input which can be used to create and +// This node represents a Template Assertion Predicate with two bools as input which can be used to create an // Initialized Assertion Predicate from (more information can be found in the summary at predicates.hpp). class TemplateAssertionPredicateNode : public Node { int _initialized_init_value_opcode; @@ -492,7 +492,8 @@ class IfNode : public MultiBranchNode { class RangeCheckNode : public IfNode { private: - int is_range_check(Node* &range, Node* &index, jint &offset); + int is_range_check(Node*& range, Node*& index, jint& offset); + public: RangeCheckNode(Node* control, Node* bol, float p, float fcnt) : IfNode(control, bol, p, fcnt) { @@ -516,7 +517,7 @@ class RangeCheckNode : public IfNode { // There are three kinds of Parse Predicates: // Loop Parse Predicate, Profiled Loop Parse Predicate (both used by Loop Predication), and Loop Limit Check Parse // Predicate (used for integer overflow checks when creating a counted loop). -// More information about predicates can be found in loopPredicate.cpp. +// More information about predicates can be found in predicates.hpp. class ParsePredicateNode : public IfNode { Deoptimization::DeoptReason _deopt_reason; bool _useless; // If the associated loop dies, this parse predicate becomes useless and can be cleaned up by Value(). diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp index 49a58bce7203e..dbab17ecb6082 100644 --- a/src/hotspot/share/opto/loopPredicate.cpp +++ b/src/hotspot/share/opto/loopPredicate.cpp @@ -612,7 +612,7 @@ bool IdealLoopTree::is_range_check_if(IfProjNode* if_success_proj, PhaseIdealLoo // (2) stride*scale < 0 // max(scale*i + offset) = scale*init + offset BoolNode* PhaseIdealLoop::rc_predicate(Node* ctrl, const int scale, Node* offset, Node* init, Node* limit, - const jint stride, Node* range, const bool upper, bool &overflow) { + const jint stride, Node* range, const bool upper, bool& overflow) { jint con_limit = (limit != nullptr && limit->is_Con()) ? limit->get_int() : 0; jint con_init = init->is_Con() ? init->get_int() : 0; jint con_offset = offset->is_Con() ? offset->get_int() : 0; @@ -1000,10 +1000,8 @@ void PhaseIdealLoop::loop_predication_follow_branches(Node *n, IdealLoopTree *lo bool PhaseIdealLoop::loop_predication_impl_helper(IdealLoopTree* loop, IfProjNode* if_success_proj, ParsePredicateSuccessProj* parse_predicate_proj, CountedLoopNode* cl, ConNode* zero, Invariance& invar, Deoptimization::DeoptReason reason) { - // Following are changed to nonnull when a predicate can be hoisted - Node* new_predicate_tail = nullptr; - IfNode* iff = if_success_proj->in(0)->as_If(); - Node* test = iff->in(1); + IfNode* iff = if_success_proj->in(0)->as_If(); + Node* test = iff->in(1); if (!test->is_Bool()) { // Conv2B, ... return false; } @@ -1085,7 +1083,9 @@ bool PhaseIdealLoop::loop_predication_impl_helper(IdealLoopTree* loop, IfProjNod IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If(); _igvn.hash_delete(lower_bound_iff); lower_bound_iff->set_req(1, lower_bound_bol); - if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx); + if (TraceLoopPredicate) { + tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx); + } // Test the upper bound BoolNode* upper_bound_bol = rc_predicate(lower_bound_proj, scale, offset, init, limit, stride, rng, true, overflow); @@ -1095,7 +1095,9 @@ bool PhaseIdealLoop::loop_predication_impl_helper(IdealLoopTree* loop, IfProjNod IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If(); _igvn.hash_delete(upper_bound_iff); upper_bound_iff->set_req(1, upper_bound_bol); - if (TraceLoopPredicate) tty->print_cr("upper bound check if: %d", lower_bound_iff->_idx); + if (TraceLoopPredicate) { + tty->print_cr("upper bound check if: %d", upper_bound_iff->_idx); + } // Each newly created Hoisted Check Predicate is accompanied by two Template Assertion Predicates. Later, we initialize // them by making a copy of them when splitting a loop into sub loops. The Assertion Predicates ensure that dead sub @@ -1293,7 +1295,7 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree* loop) { return hoisted; } -// We cannot add Loop Predicates if: +// We cannot create Loop Predicates if: // (1) There is no Loop Parse Predicate. // (2) Already added Profiled Loop Predicates (Loop Predicates and Profiled Loop Predicates can be dependent // through a data node, and thus we should only add new Profiled Loop Predicates which are below Loop Predicates diff --git a/src/hotspot/share/opto/loopUnswitch.cpp b/src/hotspot/share/opto/loopUnswitch.cpp index d8ae9550884a8..2213f4fb7ea84 100644 --- a/src/hotspot/share/opto/loopUnswitch.cpp +++ b/src/hotspot/share/opto/loopUnswitch.cpp @@ -522,10 +522,8 @@ class OriginalLoop { #endif // ASSERT }; -//-------------------------create_slow_version_of_loop------------------------ -// Create a slow version of the loop by cloning the loop -// and inserting an if to select fast-slow versions. -// Return the inserted if. +// Create a slow version of the loop by cloning the loop and inserting an If to select the fast or slow version. +// Return the inserted loop selector If. IfNode* PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree* loop, Node_List& old_new, IfNode* unswitching_candidate) { OriginalLoop original_loop(loop, &old_new); @@ -533,4 +531,3 @@ IfNode* PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree* loop, Node_Li recompute_dom_depth(); return loop_selector_if; } - diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 69316dcc964af..76812b19172db 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -1315,7 +1315,6 @@ class PhaseIdealLoop : public PhaseTransform { Deoptimization::DeoptReason reason, int opcode, bool rewire_uncommon_proj_phi_inputs = false); - private: // Helper functions for create_new_if_for_predicate() void set_ctrl_of_nodes_with_same_ctrl(Node* node, ProjNode* old_ctrl, Node* new_ctrl); diff --git a/src/hotspot/share/opto/predicates.cpp b/src/hotspot/share/opto/predicates.cpp index 7e95fbc7e105d..043b059ec0b53 100644 --- a/src/hotspot/share/opto/predicates.cpp +++ b/src/hotspot/share/opto/predicates.cpp @@ -743,12 +743,12 @@ class CreateInitializedAssertionPredicate { // Create the out nodes of a newly created Initialized Assertion Predicate If node which includes the projections and // the dedicated Halt node. IfTrueNode* create_if_proj_nodes(IfNode* if_node, IdealLoopTree* loop) { - IfTrueNode* succ_proj = new IfTrueNode(if_node); + IfTrueNode* success_proj = new IfTrueNode(if_node); IfFalseNode* fail_proj = new IfFalseNode(if_node); - _phase->register_control(succ_proj, loop, if_node); + _phase->register_control(success_proj, loop, if_node); _phase->register_control(fail_proj, loop, if_node); create_halt_node(fail_proj, loop); - return succ_proj; + return success_proj; } public: explicit CreateInitializedAssertionPredicate(PhaseIdealLoop* phase) : _phase(phase) {} diff --git a/test/hotspot/jtreg/compiler/predicates/TestAssertionPredicates.java b/test/hotspot/jtreg/compiler/predicates/TestAssertionPredicates.java index a359feeb58fec..3158724eafbfc 100644 --- a/test/hotspot/jtreg/compiler/predicates/TestAssertionPredicates.java +++ b/test/hotspot/jtreg/compiler/predicates/TestAssertionPredicates.java @@ -117,7 +117,6 @@ /* * @test id=NoFlags - * @key randomness * @bug 8288981 * @run driver compiler.predicates.TestAssertionPredicates NoFlags */