@@ -124,19 +124,19 @@ bool InlineTypeNode::has_phi_inputs(Node* region) {
124124}
125125
126126// Merges 'this' with 'other' by updating the input PhiNodes added by 'clone_with_phis'
127- InlineTypeNode* InlineTypeNode::merge_with (PhaseGVN* gvn, const InlineTypeNode* other, int pnum , bool transform) {
127+ InlineTypeNode* InlineTypeNode::merge_with (PhaseGVN* gvn, const InlineTypeNode* other, int phi_index , bool transform) {
128128 assert (inline_klass () == other->inline_klass (), " Merging incompatible types" );
129129
130130 // Merge oop inputs
131131 PhiNode* phi = get_oop ()->as_Phi ();
132- phi->set_req (pnum , other->get_oop ());
132+ phi->set_req (phi_index , other->get_oop ());
133133 if (transform) {
134134 set_oop (*gvn, gvn->transform (phi));
135135 }
136136
137137 // Merge is_buffered inputs
138138 phi = get_is_buffered ()->as_Phi ();
139- phi->set_req (pnum , other->get_is_buffered ());
139+ phi->set_req (phi_index , other->get_is_buffered ());
140140 if (transform) {
141141 set_req (IsBuffered, gvn->transform (phi));
142142 }
@@ -145,7 +145,7 @@ InlineTypeNode* InlineTypeNode::merge_with(PhaseGVN* gvn, const InlineTypeNode*
145145 Node* null_marker = get_null_marker ();
146146 if (null_marker->is_Phi ()) {
147147 phi = null_marker->as_Phi ();
148- phi->set_req (pnum , other->get_null_marker ());
148+ phi->set_req (phi_index , other->get_null_marker ());
149149 if (transform) {
150150 set_req (NullMarker, gvn->transform (phi));
151151 }
@@ -161,10 +161,15 @@ InlineTypeNode* InlineTypeNode::merge_with(PhaseGVN* gvn, const InlineTypeNode*
161161 if (val2->is_Phi ()) {
162162 val2 = gvn->transform (val2);
163163 }
164- val1->as_InlineType ()->merge_with (gvn, val2->as_InlineType (), pnum, transform);
164+ if (val2->is_top ()) {
165+ // The path where 'other' is used is dying. Therefore, we do not need to process the merge with 'other' further.
166+ // The phi inputs of 'this' at 'phi_index' will eventually be removed.
167+ break ;
168+ }
169+ val1->as_InlineType ()->merge_with (gvn, val2->as_InlineType (), phi_index, transform);
165170 } else {
166171 assert (val1->is_Phi (), " must be a phi node" );
167- val1->set_req (pnum , val2);
172+ val1->set_req (phi_index , val2);
168173 }
169174 if (transform) {
170175 set_field_value (i, gvn->transform (val1));
0 commit comments