8232539: SIGSEGV in C2 Node::unique_ctrl_out
Reviewed-by: thartmann, kvn
This commit is contained in:
parent
6e3be7fbf7
commit
afd91fd320
@ -117,7 +117,7 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
|
||||
// No intervening control, like a simple Call
|
||||
Node *r = iff->in(0);
|
||||
if( !r->is_Region() ) return NULL;
|
||||
if (r->is_Loop() && r->in(LoopNode::LoopBackControl)->is_top()) return NULL; // going away anyway
|
||||
if (r->is_Loop()) return NULL;
|
||||
if( phi->region() != r ) return NULL;
|
||||
// No other users of the cmp/bool
|
||||
if (b->outcnt() != 1 || cmp->outcnt() != 1) {
|
||||
@ -238,16 +238,13 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
|
||||
|
||||
// Make a region merging constants and a region merging the rest
|
||||
uint req_c = 0;
|
||||
Node* predicate_proj = NULL;
|
||||
int nb_predicate_proj = 0;
|
||||
for (uint ii = 1; ii < r->req(); ii++) {
|
||||
if (phi->in(ii) == con1) {
|
||||
req_c++;
|
||||
}
|
||||
Node* proj = PhaseIdealLoop::find_predicate(r->in(ii));
|
||||
if (proj != NULL) {
|
||||
nb_predicate_proj++;
|
||||
predicate_proj = proj;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,24 +254,6 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (nb_predicate_proj > 1) {
|
||||
// Can happen in case of loop unswitching and when the loop is
|
||||
// optimized out: it's not a loop anymore so we don't care about
|
||||
// predicates.
|
||||
assert(!r->is_Loop(), "this must not be a loop anymore");
|
||||
predicate_proj = NULL;
|
||||
}
|
||||
Node* predicate_c = NULL;
|
||||
Node* predicate_x = NULL;
|
||||
bool counted_loop = r->is_CountedLoop();
|
||||
if (counted_loop) {
|
||||
// Ignore counted loops for now because the split-if logic does not work
|
||||
// in all the cases (for example, with strip mined loops). Also, above
|
||||
// checks only pass for already degraded loops without a tripcount phi
|
||||
// and these are essentially dead and will go away during igvn.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Node *region_c = new RegionNode(req_c + 1);
|
||||
Node *phi_c = con1;
|
||||
uint len = r->req();
|
||||
@ -283,23 +262,11 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
|
||||
for (uint i = 1, i_c = 1, i_x = 1; i < len; i++) {
|
||||
if (phi->in(i) == con1) {
|
||||
region_c->init_req( i_c++, r ->in(i) );
|
||||
if (r->in(i) == predicate_proj)
|
||||
predicate_c = predicate_proj;
|
||||
} else {
|
||||
region_x->init_req( i_x, r ->in(i) );
|
||||
phi_x ->init_req( i_x++, phi->in(i) );
|
||||
if (r->in(i) == predicate_proj)
|
||||
predicate_x = predicate_proj;
|
||||
}
|
||||
}
|
||||
if (predicate_c != NULL && (req_c > 1)) {
|
||||
assert(predicate_x == NULL, "only one predicate entry expected");
|
||||
predicate_c = NULL; // Do not clone predicate below merge point
|
||||
}
|
||||
if (predicate_x != NULL && ((len - req_c) > 2)) {
|
||||
assert(predicate_c == NULL, "only one predicate entry expected");
|
||||
predicate_x = NULL; // Do not clone predicate below merge point
|
||||
}
|
||||
|
||||
// Register the new RegionNodes but do not transform them. Cannot
|
||||
// transform until the entire Region/Phi conglomerate has been hacked
|
||||
@ -341,20 +308,8 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
|
||||
// Make the true/false arms
|
||||
Node *iff_c_t = phase->transform(new IfTrueNode (iff_c));
|
||||
Node *iff_c_f = phase->transform(new IfFalseNode(iff_c));
|
||||
if (predicate_c != NULL) {
|
||||
assert(predicate_x == NULL, "only one predicate entry expected");
|
||||
// Clone loop predicates to each path
|
||||
iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t, !counted_loop);
|
||||
iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f, !counted_loop);
|
||||
}
|
||||
Node *iff_x_t = phase->transform(new IfTrueNode (iff_x));
|
||||
Node *iff_x_f = phase->transform(new IfFalseNode(iff_x));
|
||||
if (predicate_x != NULL) {
|
||||
assert(predicate_c == NULL, "only one predicate entry expected");
|
||||
// Clone loop predicates to each path
|
||||
iff_x_t = igvn->clone_loop_predicates(predicate_x, iff_x_t, !counted_loop);
|
||||
iff_x_f = igvn->clone_loop_predicates(predicate_x, iff_x_f, !counted_loop);
|
||||
}
|
||||
|
||||
// Merge the TRUE paths
|
||||
Node *region_s = new RegionNode(3);
|
||||
|
Loading…
Reference in New Issue
Block a user