Skip to content

Commit 86b6575

Browse files
committed
8257574: C2: "failed: parsing found no loops but there are some" assert failure
Reviewed-by: thartmann, neliasso, chagedorn
1 parent dede01e commit 86b6575

File tree

2 files changed

+60
-16
lines changed

2 files changed

+60
-16
lines changed

src/hotspot/share/opto/loopnode.cpp

+14-16
Original file line numberDiff line numberDiff line change
@@ -3663,25 +3663,23 @@ bool PhaseIdealLoop::process_expensive_nodes() {
36633663

36643664
#ifdef ASSERT
36653665
bool PhaseIdealLoop::only_has_infinite_loops() {
3666-
for (LoopTreeIterator iter(_ltree_root); !iter.done(); iter.next()) {
3667-
IdealLoopTree* lpt = iter.current();
3668-
if (lpt->is_innermost()) {
3669-
uint i = 1;
3670-
for (; i < C->root()->req(); i++) {
3671-
Node* in = C->root()->in(i);
3672-
if (in != NULL &&
3673-
in->Opcode() == Op_Halt &&
3674-
in->in(0)->is_Proj() &&
3675-
in->in(0)->in(0)->Opcode() == Op_NeverBranch &&
3676-
in->in(0)->in(0)->in(0) == lpt->_head) {
3677-
break;
3678-
}
3679-
}
3680-
if (i == C->root()->req()) {
3681-
return false;
3666+
for (IdealLoopTree* l = _ltree_root->_child; l != NULL; l = l->_next) {
3667+
uint i = 1;
3668+
for (; i < C->root()->req(); i++) {
3669+
Node* in = C->root()->in(i);
3670+
if (in != NULL &&
3671+
in->Opcode() == Op_Halt &&
3672+
in->in(0)->is_Proj() &&
3673+
in->in(0)->in(0)->Opcode() == Op_NeverBranch &&
3674+
in->in(0)->in(0)->in(0) == l->_head) {
3675+
break;
36823676
}
36833677
}
3678+
if (i == C->root()->req()) {
3679+
return false;
3680+
}
36843681
}
3682+
36853683
return true;
36863684
}
36873685
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2020, Red Hat, Inc. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/**
25+
* @test
26+
* @bug 8257574
27+
* @summary C2: "failed: parsing found no loops but there are some" assert failure
28+
*
29+
* @run main/othervm -Xcomp -XX:CompileOnly=TestInfiniteLoopNotInnerMost::test TestInfiniteLoopNotInnerMost
30+
*
31+
*/
32+
public class TestInfiniteLoopNotInnerMost {
33+
public static void main(String[] args) {
34+
test(false);
35+
}
36+
37+
private static void test(boolean flag) {
38+
if (flag) {
39+
while (true) {
40+
for (int i = 1; i < 100; i *= 2) {
41+
42+
}
43+
}
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)