From 7aed9b65d05741cb545e5716296450fb8e8bf668 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Wed, 25 Nov 2020 14:00:40 +0000 Subject: [PATCH] 8256016: Dacapo24H.java failed with "assert(false) failed: unscheduable graph" Reviewed-by: kvn, vlivanov --- src/hotspot/share/opto/ifnode.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/opto/ifnode.cpp b/src/hotspot/share/opto/ifnode.cpp index f2a24ed1857..8e093c862de 100644 --- a/src/hotspot/share/opto/ifnode.cpp +++ b/src/hotspot/share/opto/ifnode.cpp @@ -1605,7 +1605,23 @@ Node* IfNode::simple_subsuming(PhaseIterGVN* igvn) { } #endif // Replace condition with constant True(1)/False(0). - set_req(1, igvn->intcon(br == tb ? 1 : 0)); + bool is_always_true = br == tb; + set_req(1, igvn->intcon(is_always_true ? 1 : 0)); + + // Update any data dependencies to the directly dominating test. This subsumed test is not immediately removed by igvn + // and therefore subsequent optimizations might miss these data dependencies otherwise. There might be a dead loop + // ('always_taken_proj' == 'pre') that is cleaned up later. Skip this case to make the iterator work properly. + Node* always_taken_proj = proj_out(is_always_true); + if (always_taken_proj != pre) { + for (DUIterator_Fast imax, i = always_taken_proj->fast_outs(imax); i < imax; i++) { + Node* u = always_taken_proj->fast_out(i); + if (!u->is_CFG()) { + igvn->replace_input_of(u, 0, pre); + --i; + --imax; + } + } + } if (bol->outcnt() == 0) { igvn->remove_dead_node(bol); // Kill the BoolNode.