Skip to content

Commit eca7a30

Browse files
committed
8071996: split_if accesses NULL region of ConstraintCast
Backport-of: d4d8ef4585c1c6192fe35524faa6c6961d1e7a64
1 parent 5e59411 commit eca7a30

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,18 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
145145
Node* v = u->fast_out(k); // User of the phi
146146
// CNC - Allow only really simple patterns.
147147
// In particular I disallow AddP of the Phi, a fairly common pattern
148-
if( v == cmp ) continue; // The compare is OK
149-
if( (v->is_ConstraintCast()) &&
150-
v->in(0)->in(0) == iff )
151-
continue; // CastPP/II of the IfNode is OK
148+
if (v == cmp) continue; // The compare is OK
149+
if (v->is_ConstraintCast()) {
150+
// If the cast is derived from data flow edges, it may not have a control edge.
151+
// If so, it should be safe to split. But follow-up code can not deal with
152+
// this (l. 359). So skip.
153+
if (v->in(0) == NULL) {
154+
return NULL;
155+
}
156+
if (v->in(0)->in(0) == iff) {
157+
continue; // CastPP/II of the IfNode is OK
158+
}
159+
}
152160
// Disabled following code because I cannot tell if exactly one
153161
// path dominates without a real dominator check. CNC 9/9/1999
154162
//uint vop = v->Opcode();

0 commit comments

Comments
 (0)