8071996: split_if accesses NULL region of ConstraintCast

Backport-of: d4d8ef4585c1c6192fe35524faa6c6961d1e7a64
This commit is contained in:
Roland Westrelin 2025-05-13 07:22:11 +00:00
parent 5e59411bd3
commit eca7a305e1

View File

@ -145,10 +145,18 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) {
Node* v = u->fast_out(k); // User of the phi
// CNC - Allow only really simple patterns.
// In particular I disallow AddP of the Phi, a fairly common pattern
if( v == cmp ) continue; // The compare is OK
if( (v->is_ConstraintCast()) &&
v->in(0)->in(0) == iff )
continue; // CastPP/II of the IfNode is OK
if (v == cmp) continue; // The compare is OK
if (v->is_ConstraintCast()) {
// If the cast is derived from data flow edges, it may not have a control edge.
// If so, it should be safe to split. But follow-up code can not deal with
// this (l. 359). So skip.
if (v->in(0) == NULL) {
return NULL;
}
if (v->in(0)->in(0) == iff) {
continue; // CastPP/II of the IfNode is OK
}
}
// Disabled following code because I cannot tell if exactly one
// path dominates without a real dominator check. CNC 9/9/1999
//uint vop = v->Opcode();