diff -r 5f29a958a545 -r ce590301ae2a src/share/vm/opto/cfgnode.cpp --- a/src/share/vm/opto/cfgnode.cpp Tue Oct 13 20:54:13 2009 -0700 +++ b/src/share/vm/opto/cfgnode.cpp Tue Oct 13 22:32:31 2009 -0700 @@ -1531,6 +1531,8 @@ return NULL; // No change Node *top = phase->C->top(); + bool new_phi = (outcnt() == 0); // transforming new Phi + assert(!can_reshape || !new_phi, "for igvn new phi should be hooked"); // The are 2 situations when only one valid phi's input is left // (in addition to Region input). @@ -1550,6 +1552,12 @@ } } + if (can_reshape && outcnt() == 0) { + // set_req() above may kill outputs if Phi is referenced + // only by itself on the dead (top) control path. + return top; + } + Node* uin = unique_input(phase); if (uin == top) { // Simplest case: no alive inputs. if (can_reshape) // IGVN transformation @@ -1684,8 +1692,7 @@ // Equivalent code is in MemNode::Ideal_common Node *m = phase->transform(n); if (outcnt() == 0) { // Above transform() may kill us! - progress = phase->C->top(); - break; + return top; } // If transformed to a MergeMem, get the desired slice // Otherwise the returned node represents memory for every slice