-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8350578: Refactor useless Parse and Template Assertion Predicate elimination code by using a PredicateVisitor #24013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
580bab2
f06cc5f
5e4b6ca
a5611e3
1508a3b
4c9f516
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ | |
| #include "opto/connode.hpp" | ||
| #include "opto/loopnode.hpp" | ||
| #include "opto/phaseX.hpp" | ||
| #include "opto/predicates.hpp" | ||
| #include "opto/predicates_enums.hpp" | ||
| #include "opto/runtime.hpp" | ||
| #include "opto/rootnode.hpp" | ||
| #include "opto/subnode.hpp" | ||
|
|
@@ -2169,7 +2169,7 @@ Node* RangeCheckNode::Ideal(PhaseGVN *phase, bool can_reshape) { | |
| ParsePredicateNode::ParsePredicateNode(Node* control, Deoptimization::DeoptReason deopt_reason, PhaseGVN* gvn) | ||
| : IfNode(control, gvn->intcon(1), PROB_MAX, COUNT_UNKNOWN), | ||
| _deopt_reason(deopt_reason), | ||
| _useless(false) { | ||
| _predicate_state(PredicateState::Useful) { | ||
| init_class_id(Class_ParsePredicate); | ||
| gvn->C->add_parse_predicate(this); | ||
| gvn->C->record_for_post_loop_opts_igvn(this); | ||
|
|
@@ -2186,6 +2186,11 @@ ParsePredicateNode::ParsePredicateNode(Node* control, Deoptimization::DeoptReaso | |
| #endif // ASSERT | ||
| } | ||
|
|
||
| void ParsePredicateNode::mark_useless(PhaseIterGVN& igvn) { | ||
| _predicate_state = PredicateState::Useless; | ||
| igvn._worklist.push(this); | ||
| } | ||
|
|
||
| Node* ParsePredicateNode::uncommon_trap() const { | ||
| ParsePredicateUncommonProj* uncommon_proj = proj_out(0)->as_IfFalse(); | ||
| Node* uct_region_or_call = uncommon_proj->unique_ctrl_out(); | ||
|
|
@@ -2195,14 +2200,15 @@ Node* ParsePredicateNode::uncommon_trap() const { | |
|
|
||
| // Fold this node away once it becomes useless or at latest in post loop opts IGVN. | ||
| const Type* ParsePredicateNode::Value(PhaseGVN* phase) const { | ||
| assert(_predicate_state != PredicateState::MaybeUseful, "should only be MaybeUseful when eliminating useless " | ||
| "predicates during loop opts"); | ||
| if (phase->type(in(0)) == Type::TOP) { | ||
| return Type::TOP; | ||
| } | ||
| if (_useless || phase->C->post_loop_opts_phase()) { | ||
| if (_predicate_state == PredicateState::Useless || phase->C->post_loop_opts_phase()) { | ||
| return TypeTuple::IFTRUE; | ||
| } else { | ||
| return bottom_type(); | ||
| } | ||
| return bottom_type(); | ||
| } | ||
|
|
||
| #ifndef PRODUCT | ||
|
|
@@ -2224,7 +2230,7 @@ void ParsePredicateNode::dump_spec(outputStream* st) const { | |
| default: | ||
| fatal("unknown kind"); | ||
| } | ||
| if (_useless) { | ||
| if (_predicate_state == PredicateState::Useless) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only print |
||
| st->print("#useless "); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -511,6 +511,9 @@ Node *Node::clone() const { | |
| if (n->is_ParsePredicate()) { | ||
| C->add_parse_predicate(n->as_ParsePredicate()); | ||
| } | ||
| if (n->is_OpaqueTemplateAssertionPredicate()) { | ||
| C->add_template_assertion_predicate_opaque(n->as_OpaqueTemplateAssertionPredicate()); | ||
| } | ||
|
Comment on lines
+514
to
+516
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See PR description "Other Included Changes". |
||
|
|
||
| BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); | ||
| bs->register_potential_barrier_node(n); | ||
|
|
@@ -607,7 +610,7 @@ void Node::destruct(PhaseValues* phase) { | |
| compile->remove_expensive_node(this); | ||
| } | ||
| if (is_OpaqueTemplateAssertionPredicate()) { | ||
| compile->remove_template_assertion_predicate_opaq(this); | ||
| compile->remove_template_assertion_predicate_opaque(as_OpaqueTemplateAssertionPredicate()); | ||
| } | ||
| if (is_ParsePredicate()) { | ||
| compile->remove_parse_predicate(as_ParsePredicate()); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best effort assert to ensure we are not seeing
MaybeUsefulanywhere else except during Predicate elimination. Same forOpaqueTemplateAssertionPredicate.