8252583: Clean up unused phi-to-copy degradation mechanism

Remove unused notion of 'PhiNode-to-copy degradation', where PhiNodes can be
degraded to copies by setting their RegionNode to NULL. Remove corresponding
PhiNode::is_copy() test, which always returned NULL (false). Assert that
PhiNodes have an associated RegionNode in PhiNode::Ideal().

Reviewed-by: thartmann, kvn
This commit is contained in:
Roberto Castaneda Lozano 2020-09-24 08:10:56 +00:00 committed by Tobias Hartmann
parent 4440bda325
commit f3ea0d362f
7 changed files with 10 additions and 29 deletions

@ -91,9 +91,9 @@ static bool commute(Node *add, bool con_left, bool con_right) {
PhiNode *phi;
// Check for tight loop increments: Loop-phi of Add of loop-phi
if( in1->is_Phi() && (phi = in1->as_Phi()) && !phi->is_copy() && phi->region()->is_Loop() && phi->in(2)==add)
if (in1->is_Phi() && (phi = in1->as_Phi()) && phi->region()->is_Loop() && phi->in(2) == add)
return false;
if( in2->is_Phi() && (phi = in2->as_Phi()) && !phi->is_copy() && phi->region()->is_Loop() && phi->in(2)==add){
if (in2->is_Phi() && (phi = in2->as_Phi()) && phi->region()->is_Loop() && phi->in(2) == add) {
add->swap_edges(1, 2);
return true;
}

@ -548,7 +548,7 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) {
assert( igvn->eqv(n->in(0), this), "" );
assert( n->req() == 2 && n->in(1) != NULL, "Only one data input expected" );
// Break dead loop data path.
// Eagerly replace phis with top to avoid phis copies generation.
// Eagerly replace phis with top to avoid regionless phis.
igvn->replace_node(n, top);
if( max != outcnt() ) {
progress = true;
@ -589,7 +589,7 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) {
assert( req() == 1, "no inputs expected" );
// During IGVN phase such region will be subsumed by TOP node
// so region's phis will have TOP as control node.
// Kill phis here to avoid it. PhiNode::is_copy() will be always false.
// Kill phis here to avoid it.
// Also set other user's input to top.
parent_ctrl = phase->C->top();
} else {
@ -604,7 +604,7 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* n = last_out(i);
igvn->hash_delete(n); // Remove from worklist before modifying edges
if( n->is_Phi() ) { // Collapse all Phis
// Eagerly replace phis to avoid copies generation.
// Eagerly replace phis to avoid regionless phis.
Node* in;
if( cnt == 0 ) {
assert( n->req() == 1, "No data inputs expected" );
@ -1377,7 +1377,6 @@ Node* PhiNode::unique_input(PhaseTransform* phase, bool uncast) {
// phi / --
Node* r = in(0); // RegionNode
if (r == NULL) return in(1); // Already degraded to a Copy
Node* input = NULL; // The unique direct input (maybe uncasted = ConstraintCasts removed)
for (uint i = 1, cnt = req(); i < cnt; ++i) {
@ -1861,11 +1860,8 @@ bool PhiNode::wait_for_region_igvn(PhaseGVN* phase) {
// Return a node which is more "ideal" than the current node. Must preserve
// the CFG, but we can still strip out dead paths.
Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// The next should never happen after 6297035 fix.
if( is_copy() ) // Already degraded to a Copy ?
return NULL; // No change
Node *r = in(0); // RegionNode
assert(r != NULL && r->is_Region(), "this phi must have a region");
assert(r->in(0) == NULL || !r->in(0)->is_Root(), "not a specially hidden merge");
// Note: During parsing, phis are often transformed before their regions.

@ -115,9 +115,7 @@ class JProjNode : public ProjNode {
//------------------------------PhiNode----------------------------------------
// PhiNodes merge values from different Control paths. Slot 0 points to the
// controlling RegionNode. Other slots map 1-for-1 with incoming control flow
// paths to the RegionNode. For speed reasons (to avoid another pass) we
// can turn PhiNodes into copys in-place by NULL'ing out their RegionNode
// input in slot 0.
// paths to the RegionNode.
class PhiNode : public TypeNode {
friend class PhaseRenumberLive;
@ -173,13 +171,6 @@ public:
// Accessors
RegionNode* region() const { Node* r = in(Region); assert(!r || r->is_Region(), ""); return (RegionNode*)r; }
Node* is_copy() const {
// The node is a real phi if _in[0] is a Region node.
DEBUG_ONLY(const Node* r = _in[Region];)
assert(r != NULL && r->is_Region(), "Not valid control");
return NULL; // not a copy!
}
bool is_tripcount() const;
// Determine a unique non-trivial input, if any.

@ -86,7 +86,6 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
i1 = cmp->in(1);
if( i1 == NULL || !i1->is_Phi() ) return NULL;
PhiNode *phi = i1->as_Phi();
if( phi->is_copy() ) return NULL;
Node *con2 = cmp->in(2);
if( !con2->is_Con() ) return NULL;
// See that the merge point contains some constants

@ -49,7 +49,7 @@
// Determine if a node is a counted loop induction variable.
// NOTE: The method is declared in "node.hpp".
bool Node::is_cloop_ind_var() const {
return (is_Phi() && !as_Phi()->is_copy() &&
return (is_Phi() &&
as_Phi()->region()->is_CountedLoop() &&
as_Phi()->region()->as_CountedLoop()->phi() == this);
}

@ -4572,8 +4572,7 @@ Node *MergeMemNode::Ideal(PhaseGVN *phase, bool can_reshape) {
Node* phi_reg = NULL;
uint phi_len = (uint)-1;
if (phi_base != NULL && !phi_base->is_copy()) {
// do not examine phi if degraded to a copy
if (phi_base != NULL) {
phi_reg = phi_base->region();
phi_len = phi_base->req();
// see if the phi is unfinished
@ -4888,10 +4887,6 @@ bool MergeMemStream::match_memory(Node* mem, const MergeMemNode* mm, int idx) {
if (mem == n) return true; // might be empty_memory()
n = (idx == Compile::AliasIdxBot)? mm->base_memory(): mm->memory_at(idx);
if (mem == n) return true;
while (n->is_Phi() && (n = n->as_Phi()->is_copy()) != NULL) {
if (mem == n) return true;
if (n == NULL) break;
}
return false;
}
#endif // !PRODUCT

@ -124,7 +124,7 @@ static bool is_cloop_increment(Node* inc) {
}
const PhiNode* phi = inc->in(1)->as_Phi();
if (phi->is_copy() || !phi->region()->is_CountedLoop()) {
if (!phi->region()->is_CountedLoop()) {
return false;
}