Skip to content

Commit

Permalink
8241533: [lworld] PhaseMacroExpand::migrate_outs should be replaced b…
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiHartmann committed Mar 27, 2020
1 parent 0bca291 commit 78b0ffd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
26 changes: 7 additions & 19 deletions src/hotspot/share/opto/macro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,6 @@ int PhaseMacroExpand::replace_input(Node *use, Node *oldref, Node *newref) {
return nreplacements;
}

void PhaseMacroExpand::migrate_outs(Node *old, Node *target) {
assert(old != NULL, "sanity");
for (DUIterator_Fast imax, i = old->fast_outs(imax); i < imax; i++) {
Node* use = old->fast_out(i);
_igvn.rehash_node_delayed(use);
imax -= replace_input(use, old, target);
// back up iterator
--i;
}
assert(old->outcnt() == 0, "all uses must be deleted");
}

Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path) {
Node* cmp;
if (mask != 0) {
Expand Down Expand Up @@ -1565,7 +1553,7 @@ void PhaseMacroExpand::expand_allocate_common(
// result_phi_rawmem (unless we are only generating a slow call when
// both memory projections are combined)
if (expand_fast_path && _memproj_fallthrough != NULL) {
migrate_outs(_memproj_fallthrough, result_phi_rawmem);
_igvn.replace_in_uses(_memproj_fallthrough, result_phi_rawmem);
}
// Now change uses of _memproj_catchall to use _memproj_fallthrough and delete
// _memproj_catchall so we end up with a call that has only 1 memory projection.
Expand All @@ -1574,7 +1562,7 @@ void PhaseMacroExpand::expand_allocate_common(
_memproj_fallthrough = new ProjNode(call, TypeFunc::Memory);
transform_later(_memproj_fallthrough);
}
migrate_outs(_memproj_catchall, _memproj_fallthrough);
_igvn.replace_in_uses(_memproj_catchall, _memproj_fallthrough);
_igvn.remove_dead_node(_memproj_catchall);
}

Expand All @@ -1584,7 +1572,7 @@ void PhaseMacroExpand::expand_allocate_common(
// (it is different from memory projections where both projections are
// combined in such case).
if (_ioproj_fallthrough != NULL) {
migrate_outs(_ioproj_fallthrough, result_phi_i_o);
_igvn.replace_in_uses(_ioproj_fallthrough, result_phi_i_o);
}
// Now change uses of _ioproj_catchall to use _ioproj_fallthrough and delete
// _ioproj_catchall so we end up with a call that has only 1 i_o projection.
Expand All @@ -1593,7 +1581,7 @@ void PhaseMacroExpand::expand_allocate_common(
_ioproj_fallthrough = new ProjNode(call, TypeFunc::I_O);
transform_later(_ioproj_fallthrough);
}
migrate_outs(_ioproj_catchall, _ioproj_fallthrough);
_igvn.replace_in_uses(_ioproj_catchall, _ioproj_fallthrough);
_igvn.remove_dead_node(_ioproj_catchall);
}

Expand Down Expand Up @@ -1661,7 +1649,7 @@ void PhaseMacroExpand::yank_alloc_node(AllocateNode* alloc) {
_igvn.remove_dead_node(_resproj);
}
if (_fallthroughcatchproj != NULL) {
migrate_outs(_fallthroughcatchproj, ctrl);
_igvn.replace_in_uses(_fallthroughcatchproj, ctrl);
_igvn.remove_dead_node(_fallthroughcatchproj);
}
if (_catchallcatchproj != NULL) {
Expand All @@ -1674,11 +1662,11 @@ void PhaseMacroExpand::yank_alloc_node(AllocateNode* alloc) {
_igvn.remove_dead_node(_fallthroughproj);
}
if (_memproj_fallthrough != NULL) {
migrate_outs(_memproj_fallthrough, mem);
_igvn.replace_in_uses(_memproj_fallthrough, mem);
_igvn.remove_dead_node(_memproj_fallthrough);
}
if (_ioproj_fallthrough != NULL) {
migrate_outs(_ioproj_fallthrough, i_o);
_igvn.replace_in_uses(_ioproj_fallthrough, i_o);
_igvn.remove_dead_node(_ioproj_fallthrough);
}
if (_memproj_catchall != NULL) {
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/opto/macro.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ class PhaseMacroExpand : public Phase {
void expand_subtypecheck_node(SubTypeCheckNode *check);

int replace_input(Node *use, Node *oldref, Node *newref);
void migrate_outs(Node *old, Node *target);
Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/opto/phaseX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,7 @@ void PhaseIterGVN::subsume_node( Node *old, Node *nn ) {
}

void PhaseIterGVN::replace_in_uses(Node* n, Node* m) {
assert(n != NULL, "sanity");
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
Node* u = n->fast_out(i);
if (u != n) {
Expand All @@ -1504,6 +1505,7 @@ void PhaseIterGVN::replace_in_uses(Node* n, Node* m) {
--i, imax -= nb;
}
}
assert(n->outcnt() == 0, "all uses must be deleted");
}

//------------------------------add_users_to_worklist--------------------------
Expand Down

0 comments on commit 78b0ffd

Please sign in to comment.