8240794: [BACKOUT] 8238384 CTW: C2 compilation fails with "assert(store != load->find_exact_control(load->in(0))) failed: dependence cycle found"

Reviewed-by: thartmann
This commit is contained in:
Roland Westrelin 2020-03-10 10:45:01 +01:00
parent d112950b5b
commit 43e0165eea
7 changed files with 20 additions and 82 deletions

View file

@ -707,6 +707,19 @@ Block* PhaseCFG::insert_anti_dependences(Block* LCA, Node* load, bool verify) {
// instead of control + memory.
if (mstore->ideal_Opcode() == Op_SafePoint)
continue;
// Check if the store is a membar on which the load is control dependent.
// Inserting an anti-dependency between that membar and the load would
// create a cycle that causes local scheduling to fail.
if (mstore->isa_MachMemBar()) {
Node* dom = load->find_exact_control(load->in(0));
while (dom != NULL && dom != dom->in(0) && dom != mstore) {
dom = dom->in(0);
}
if (dom == mstore) {
continue;
}
}
} else {
// Some raw memory, such as the load of "top" at an allocation,
// can be control dependent on the previous safepoint. See