8281732: add assert for non-NULL assumption for return of unique_ctrl_out
Reviewed-by: kvn, chagedorn, thartmann
This commit is contained in:
parent
d8f44aa39e
commit
395bc141f2
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -906,7 +906,7 @@ void CallNode::extract_projections(CallProjections* projs, bool separate_io_proj
|
||||
{
|
||||
// For Control (fallthrough) and I_O (catch_all_index) we have CatchProj -> Catch -> Proj
|
||||
projs->fallthrough_proj = pn;
|
||||
const Node *cn = pn->unique_ctrl_out();
|
||||
const Node* cn = pn->unique_ctrl_out_or_null();
|
||||
if (cn != NULL && cn->is_Catch()) {
|
||||
ProjNode *cpn = NULL;
|
||||
for (DUIterator_Fast kmax, k = cn->fast_outs(kmax); k < kmax; k++) {
|
||||
@ -1414,7 +1414,7 @@ Node* SafePointNode::Identity(PhaseGVN* phase) {
|
||||
|
||||
// If you have back to back safepoints, remove one
|
||||
if (in(TypeFunc::Control)->is_SafePoint()) {
|
||||
Node* out_c = unique_ctrl_out();
|
||||
Node* out_c = unique_ctrl_out_or_null();
|
||||
// This can be the safepoint of an outer strip mined loop if the inner loop's backedge was removed. Replacing the
|
||||
// outer loop's safepoint could confuse removal of the outer loop.
|
||||
if (out_c != NULL && !out_c->is_OuterStripMinedLoopEnd()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -865,10 +865,10 @@ bool RegionNode::optimize_trichotomy(PhaseIterGVN* igvn) {
|
||||
}
|
||||
proj1 = proj1->other_if_proj();
|
||||
proj2 = proj2->other_if_proj();
|
||||
if (!((proj1->unique_ctrl_out() == iff2 &&
|
||||
proj2->unique_ctrl_out() == this) ||
|
||||
(proj2->unique_ctrl_out() == iff1 &&
|
||||
proj1->unique_ctrl_out() == this))) {
|
||||
if (!((proj1->unique_ctrl_out_or_null() == iff2 &&
|
||||
proj2->unique_ctrl_out_or_null() == this) ||
|
||||
(proj2->unique_ctrl_out_or_null() == iff1 &&
|
||||
proj1->unique_ctrl_out_or_null() == this))) {
|
||||
return false; // Ifs are not connected through other projs
|
||||
}
|
||||
// Found 'iff -> proj -> iff -> proj -> this' shape where all other projs are merged
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -739,7 +739,7 @@ bool IfNode::is_ctrl_folds(Node* ctrl, PhaseIterGVN* igvn) {
|
||||
// Do this If and the dominating If share a region?
|
||||
bool IfNode::has_shared_region(ProjNode* proj, ProjNode*& success, ProjNode*& fail) {
|
||||
ProjNode* otherproj = proj->other_if_proj();
|
||||
Node* otherproj_ctrl_use = otherproj->unique_ctrl_out();
|
||||
Node* otherproj_ctrl_use = otherproj->unique_ctrl_out_or_null();
|
||||
RegionNode* region = (otherproj_ctrl_use != NULL && otherproj_ctrl_use->is_Region()) ? otherproj_ctrl_use->as_Region() : NULL;
|
||||
success = NULL;
|
||||
fail = NULL;
|
||||
@ -1724,7 +1724,7 @@ Node* IfProjNode::Identity(PhaseGVN* phase) {
|
||||
if (in(0)->is_BaseCountedLoopEnd()) {
|
||||
// CountedLoopEndNode may be eliminated by if subsuming, replace CountedLoopNode with LoopNode to
|
||||
// avoid mismatching between CountedLoopNode and CountedLoopEndNode in the following optimization.
|
||||
Node* head = unique_ctrl_out();
|
||||
Node* head = unique_ctrl_out_or_null();
|
||||
if (head != NULL && head->is_BaseCountedLoop() && head->in(LoopNode::LoopBackControl) == this) {
|
||||
Node* new_head = new LoopNode(head->in(LoopNode::EntryControl), this);
|
||||
phase->is_IterGVN()->register_new_node_with_optimizer(new_head);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1189,7 +1189,7 @@ public:
|
||||
assert(con >= CatchProjNode::catch_all_index, "what else?");
|
||||
_freqs.at_put_grow(c->_idx, 0, -1);
|
||||
}
|
||||
} else if (c->unique_ctrl_out() == NULL && !c->is_If() && !c->is_Jump()) {
|
||||
} else if (c->unique_ctrl_out_or_null() == NULL && !c->is_If() && !c->is_Jump()) {
|
||||
ShouldNotReachHere();
|
||||
} else {
|
||||
c = c->in(0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -2846,7 +2846,7 @@ bool OuterStripMinedLoopEndNode::is_expanded(PhaseGVN *phase) const {
|
||||
if (phase->is_IterGVN()) {
|
||||
Node* backedge = proj_out_or_null(true);
|
||||
if (backedge != NULL) {
|
||||
Node* head = backedge->unique_ctrl_out();
|
||||
Node* head = backedge->unique_ctrl_out_or_null();
|
||||
if (head != NULL && head->is_OuterStripMinedLoop()) {
|
||||
if (head->find_out_with(Op_Phi) != NULL) {
|
||||
return true;
|
||||
@ -5756,8 +5756,8 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) {
|
||||
// Try not to place code on a loop entry projection
|
||||
// which can inhibit range check elimination.
|
||||
if (least != early) {
|
||||
Node* ctrl_out = least->unique_ctrl_out();
|
||||
if (ctrl_out && ctrl_out->is_Loop() &&
|
||||
Node* ctrl_out = least->unique_ctrl_out_or_null();
|
||||
if (ctrl_out != NULL && ctrl_out->is_Loop() &&
|
||||
least == ctrl_out->in(LoopNode::EntryControl) &&
|
||||
(ctrl_out->is_CountedLoop() || ctrl_out->is_OuterStripMinedLoop())) {
|
||||
Node* least_dom = idom(least);
|
||||
|
@ -188,7 +188,7 @@ CallStaticJavaNode* ProjNode::is_uncommon_trap_proj(Deoptimization::DeoptReason
|
||||
int path_limit = 10;
|
||||
Node* out = this;
|
||||
for (int ct = 0; ct < path_limit; ct++) {
|
||||
out = out->unique_ctrl_out();
|
||||
out = out->unique_ctrl_out_or_null();
|
||||
if (out == NULL)
|
||||
return NULL;
|
||||
if (out->is_CallStaticJava()) {
|
||||
|
@ -2387,9 +2387,9 @@ Node* Node::find_similar(int opc) {
|
||||
}
|
||||
|
||||
|
||||
//--------------------------unique_ctrl_out------------------------------
|
||||
//--------------------------unique_ctrl_out_or_null-------------------------
|
||||
// Return the unique control out if only one. Null if none or more than one.
|
||||
Node* Node::unique_ctrl_out() const {
|
||||
Node* Node::unique_ctrl_out_or_null() const {
|
||||
Node* found = NULL;
|
||||
for (uint i = 0; i < outcnt(); i++) {
|
||||
Node* use = raw_out(i);
|
||||
@ -2403,6 +2403,14 @@ Node* Node::unique_ctrl_out() const {
|
||||
return found;
|
||||
}
|
||||
|
||||
//--------------------------unique_ctrl_out------------------------------
|
||||
// Return the unique control out. Asserts if none or more than one control out.
|
||||
Node* Node::unique_ctrl_out() const {
|
||||
Node* ctrl = unique_ctrl_out_or_null();
|
||||
assert(ctrl != NULL, "control out is assumed to be unique");
|
||||
return ctrl;
|
||||
}
|
||||
|
||||
void Node::ensure_control_or_add_prec(Node* c) {
|
||||
if (in(0) == NULL) {
|
||||
set_req(0, c);
|
||||
|
@ -1084,6 +1084,8 @@ public:
|
||||
Node* find_similar(int opc);
|
||||
|
||||
// Return the unique control out if only one. Null if none or more than one.
|
||||
Node* unique_ctrl_out_or_null() const;
|
||||
// Return the unique control out. Asserts if none or more than one control out.
|
||||
Node* unique_ctrl_out() const;
|
||||
|
||||
// Set control or add control as precedence edge
|
||||
|
Loading…
x
Reference in New Issue
Block a user