Skip to content

Commit 6e3a158

Browse files
Wang HuangWu Yan
authored and
Vladimir Kozlov
committedMar 24, 2021
8263352: assert(use == polladr) failed: the use should be a safepoint polling
Co-authored-by: Wang Huang <whuang@openjdk.org> Co-authored-by: Wu Yan <wuyan34@huawei.com> Reviewed-by: kvn
1 parent 8d63bb6 commit 6e3a158

File tree

2 files changed

+84
-8
lines changed

2 files changed

+84
-8
lines changed
 

‎src/hotspot/share/opto/loopTransform.cpp

+6-8
Original file line numberDiff line numberDiff line change
@@ -3705,17 +3705,15 @@ bool PhaseIdealLoop::match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& st
37053705
// In strip-mined counted loops, the CountedLoopNode may be
37063706
// used by the address polling node of the outer safepoint.
37073707
// Skip this use because it's safe.
3708-
#ifdef ASSERT
37093708
Node* sfpt = n->as_CountedLoop()->outer_safepoint();
37103709
Node* polladr = sfpt->in(TypeFunc::Parms+0);
3711-
assert(use == polladr, "the use should be a safepoint polling");
3712-
#endif
3713-
continue;
3714-
} else {
3715-
msg = "node is used outside loop";
3716-
msg_node = n;
3717-
break;
3710+
if (use == polladr) {
3711+
continue;
3712+
}
37183713
}
3714+
msg = "node is used outside loop";
3715+
msg_node = n;
3716+
break;
37193717
}
37203718
}
37213719
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright (c) 2021, Huawei Technologies Co., Ltd. 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 8263352
27+
* @summary assert(use == polladr) failed: the use should be a safepoint polling
28+
* @requires vm.flavor == "server"
29+
*
30+
* @run main/othervm -XX:-BackgroundCompilation -XX:+OptimizeFill
31+
* compiler.loopopts.TestOptimizeFillWithStripMinedLoop
32+
*
33+
*/
34+
35+
package compiler.loopopts;
36+
37+
public class TestOptimizeFillWithStripMinedLoop {
38+
39+
class Wrap {
40+
public int value;
41+
public Wrap(int v) {
42+
value = v;
43+
}
44+
}
45+
46+
public static int size = 1024;
47+
public static int[] ia = new int[size];
48+
49+
public static void main(String[] args) throws Exception {
50+
TestOptimizeFillWithStripMinedLoop m = new TestOptimizeFillWithStripMinedLoop();
51+
m.test();
52+
}
53+
54+
public void test() throws Exception {
55+
for(int i = 0; i < 20_000; i++) {
56+
Wrap obj = null;
57+
if (i % 113 != 0) {
58+
obj = new Wrap(i);
59+
}
60+
foo(obj);
61+
}
62+
}
63+
64+
public int foo(Wrap obj) throws Exception {
65+
boolean condition = false;
66+
int first = -1;
67+
68+
if (obj == null) {
69+
condition = true;
70+
first = 24;
71+
}
72+
73+
for (int i = 0; i < size; i++) {
74+
ia[i] = condition ? first : obj.value;
75+
}
76+
return 0;
77+
}
78+
}

0 commit comments

Comments
 (0)