Skip to content

Commit b47b206

Browse files
committed
8355674: C2: Partial Peeling should not introduce Phi nodes above OpaqueInitializedAssertionPredicate nodes
Reviewed-by: epeter, thartmann
1 parent 5df7089 commit b47b206

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

src/hotspot/share/opto/loopopts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3391,7 +3391,7 @@ void PhaseIdealLoop::clone_for_special_use_inside_loop( IdealLoopTree *loop, Nod
33913391
for (DUIterator_Fast jmax, j = n->fast_outs(jmax); j < jmax; j++) {
33923392
Node* use = n->fast_out(j);
33933393
if ( not_peel.test(use->_idx) &&
3394-
(use->is_If() || use->is_CMove() || use->is_Bool()) &&
3394+
(use->is_If() || use->is_CMove() || use->is_Bool() || use->is_OpaqueInitializedAssertionPredicate()) &&
33953395
use->in(1) == n) {
33963396
worklist.push(use);
33973397
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. 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 8355674
27+
* @summary Check that we do not introduce a Phi above a OpaqueInitializedAssertionPredicateNode during Partial Peeling.
28+
* @run main/othervm -Xcomp -XX:CompileOnly=compiler.predicates.assertion.TestPhiAboveOpaqueInitializedAssertionPredicate::test
29+
* compiler.predicates.assertion.TestPhiAboveOpaqueInitializedAssertionPredicate
30+
* @run main compiler.predicates.assertion.TestPhiAboveOpaqueInitializedAssertionPredicate
31+
*/
32+
33+
package compiler.predicates.assertion;
34+
35+
public class TestPhiAboveOpaqueInitializedAssertionPredicate {
36+
public static void main(String[] o) {
37+
for (int i = 0; i < 1000; i++) {
38+
test();
39+
}
40+
}
41+
42+
static void test() {
43+
int e;
44+
int h = 8;
45+
int[][] iArr = new int[100][100];
46+
for (float j = 8; j < 100 ; ++j) {
47+
for (int f = 5; f > 1; f -= 2) {
48+
for (int g = 1; 3 > g; ++g) {
49+
try {
50+
e = iArr[(int) j][g] / h;
51+
} catch (ArithmeticException k) {
52+
}
53+
h += g;
54+
}
55+
}
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)