Skip to content

Commit afd91fd

Browse files
committedOct 22, 2019
8232539: SIGSEGV in C2 Node::unique_ctrl_out
Reviewed-by: thartmann, kvn
1 parent 6e3be7f commit afd91fd

File tree

1 file changed

+2
-47
lines changed

1 file changed

+2
-47
lines changed
 

‎src/hotspot/share/opto/ifnode.cpp

+2-47
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
117117
// No intervening control, like a simple Call
118118
Node *r = iff->in(0);
119119
if( !r->is_Region() ) return NULL;
120-
if (r->is_Loop() && r->in(LoopNode::LoopBackControl)->is_top()) return NULL; // going away anyway
120+
if (r->is_Loop()) return NULL;
121121
if( phi->region() != r ) return NULL;
122122
// No other users of the cmp/bool
123123
if (b->outcnt() != 1 || cmp->outcnt() != 1) {
@@ -238,16 +238,13 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
238238

239239
// Make a region merging constants and a region merging the rest
240240
uint req_c = 0;
241-
Node* predicate_proj = NULL;
242-
int nb_predicate_proj = 0;
243241
for (uint ii = 1; ii < r->req(); ii++) {
244242
if (phi->in(ii) == con1) {
245243
req_c++;
246244
}
247245
Node* proj = PhaseIdealLoop::find_predicate(r->in(ii));
248246
if (proj != NULL) {
249-
nb_predicate_proj++;
250-
predicate_proj = proj;
247+
return NULL;
251248
}
252249
}
253250

@@ -257,24 +254,6 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
257254
return NULL;
258255
}
259256

260-
if (nb_predicate_proj > 1) {
261-
// Can happen in case of loop unswitching and when the loop is
262-
// optimized out: it's not a loop anymore so we don't care about
263-
// predicates.
264-
assert(!r->is_Loop(), "this must not be a loop anymore");
265-
predicate_proj = NULL;
266-
}
267-
Node* predicate_c = NULL;
268-
Node* predicate_x = NULL;
269-
bool counted_loop = r->is_CountedLoop();
270-
if (counted_loop) {
271-
// Ignore counted loops for now because the split-if logic does not work
272-
// in all the cases (for example, with strip mined loops). Also, above
273-
// checks only pass for already degraded loops without a tripcount phi
274-
// and these are essentially dead and will go away during igvn.
275-
return NULL;
276-
}
277-
278257
Node *region_c = new RegionNode(req_c + 1);
279258
Node *phi_c = con1;
280259
uint len = r->req();
@@ -283,23 +262,11 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
283262
for (uint i = 1, i_c = 1, i_x = 1; i < len; i++) {
284263
if (phi->in(i) == con1) {
285264
region_c->init_req( i_c++, r ->in(i) );
286-
if (r->in(i) == predicate_proj)
287-
predicate_c = predicate_proj;
288265
} else {
289266
region_x->init_req( i_x, r ->in(i) );
290267
phi_x ->init_req( i_x++, phi->in(i) );
291-
if (r->in(i) == predicate_proj)
292-
predicate_x = predicate_proj;
293268
}
294269
}
295-
if (predicate_c != NULL && (req_c > 1)) {
296-
assert(predicate_x == NULL, "only one predicate entry expected");
297-
predicate_c = NULL; // Do not clone predicate below merge point
298-
}
299-
if (predicate_x != NULL && ((len - req_c) > 2)) {
300-
assert(predicate_c == NULL, "only one predicate entry expected");
301-
predicate_x = NULL; // Do not clone predicate below merge point
302-
}
303270

304271
// Register the new RegionNodes but do not transform them. Cannot
305272
// transform until the entire Region/Phi conglomerate has been hacked
@@ -341,20 +308,8 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
341308
// Make the true/false arms
342309
Node *iff_c_t = phase->transform(new IfTrueNode (iff_c));
343310
Node *iff_c_f = phase->transform(new IfFalseNode(iff_c));
344-
if (predicate_c != NULL) {
345-
assert(predicate_x == NULL, "only one predicate entry expected");
346-
// Clone loop predicates to each path
347-
iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t, !counted_loop);
348-
iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f, !counted_loop);
349-
}
350311
Node *iff_x_t = phase->transform(new IfTrueNode (iff_x));
351312
Node *iff_x_f = phase->transform(new IfFalseNode(iff_x));
352-
if (predicate_x != NULL) {
353-
assert(predicate_c == NULL, "only one predicate entry expected");
354-
// Clone loop predicates to each path
355-
iff_x_t = igvn->clone_loop_predicates(predicate_x, iff_x_t, !counted_loop);
356-
iff_x_f = igvn->clone_loop_predicates(predicate_x, iff_x_f, !counted_loop);
357-
}
358313

359314
// Merge the TRUE paths
360315
Node *region_s = new RegionNode(3);

0 commit comments

Comments
 (0)
Please sign in to comment.