diff -r 9cbafea410f5 -r f7691a80458c src/share/vm/opto/loopnode.cpp --- a/src/share/vm/opto/loopnode.cpp Mon May 25 07:03:06 2020 +0100 +++ b/src/share/vm/opto/loopnode.cpp Mon May 25 14:24:27 2020 +0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1538,10 +1538,18 @@ // If I am a shared header (multiple backedges), peel off the many // backedges into a private merge point and use the merge point as // the one true backedge. - if (_head->req() > 3 && !_irreducible) { + if (_head->req() > 3) { // Merge the many backedges into a single backedge but leave // the hottest backedge as separate edge for the following peel. - merge_many_backedges( phase ); + if (!_irreducible) { + merge_many_backedges( phase ); + } + + // When recursively beautify my children, split_fall_in can change + // loop tree structure when I am an irreducible loop. Then the head + // of my children has a req() not bigger than 3. Here we need to set + // result to true to catch that case in order to tell the caller to + // rebuild loop tree. See issue JDK-8244407 for details. result = true; }