8314233: C2: assert(assertion_predicate_has_loop_opaque_node(iff)) failed: unexpected
Reviewed-by: thartmann, kvn
This commit is contained in:
parent
e1fdef5613
commit
0b12480de8
@ -2079,12 +2079,17 @@ void PhaseIdealLoop::initialize_assertion_predicates_for_peeled_loop(const Predi
|
|||||||
Node* control = outer_loop_head->in(LoopNode::EntryControl);
|
Node* control = outer_loop_head->in(LoopNode::EntryControl);
|
||||||
Node* input_proj = control;
|
Node* input_proj = control;
|
||||||
|
|
||||||
|
const Node* parse_predicate_uncommon_trap = predicate_block->parse_predicate()->uncommon_trap();
|
||||||
Node* next_regular_predicate_proj = predicate_block->skip_parse_predicate();
|
Node* next_regular_predicate_proj = predicate_block->skip_parse_predicate();
|
||||||
while (next_regular_predicate_proj->is_IfProj()) {
|
while (next_regular_predicate_proj->is_IfProj()) {
|
||||||
IfNode* iff = next_regular_predicate_proj->in(0)->as_If();
|
IfNode* iff = next_regular_predicate_proj->in(0)->as_If();
|
||||||
|
ProjNode* uncommon_proj = iff->proj_out(1 - next_regular_predicate_proj->as_Proj()->_con);
|
||||||
|
if (uncommon_proj->unique_ctrl_out() != parse_predicate_uncommon_trap) {
|
||||||
|
// Does not belong to this Predicate Block anymore.
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (iff->in(1)->Opcode() == Op_Opaque4) {
|
if (iff->in(1)->Opcode() == Op_Opaque4) {
|
||||||
assert(assertion_predicate_has_loop_opaque_node(iff), "unexpected");
|
assert(assertion_predicate_has_loop_opaque_node(iff), "unexpected");
|
||||||
ProjNode* uncommon_proj = iff->proj_out(1 - next_regular_predicate_proj->as_Proj()->_con);
|
|
||||||
input_proj = clone_assertion_predicate_and_initialize(iff, init, stride, next_regular_predicate_proj, uncommon_proj, control,
|
input_proj = clone_assertion_predicate_and_initialize(iff, init, stride, next_regular_predicate_proj, uncommon_proj, control,
|
||||||
outer_loop, input_proj);
|
outer_loop, input_proj);
|
||||||
|
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, 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
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8314233
|
||||||
|
* @requires vm.compiler2.enabled
|
||||||
|
* @summary Test that loop peeling does not treat unrelated Opaque4 node as Template Assertion Predicate.
|
||||||
|
* @run main/othervm -Xbatch -XX:LoopMaxUnroll=0
|
||||||
|
* -XX:CompileCommand=compileonly,compiler.predicates.TestPeelingFindsUnrelatedOpaque4Node::*
|
||||||
|
* -XX:CompileCommand=inline,*String::* compiler.predicates.TestPeelingFindsUnrelatedOpaque4Node
|
||||||
|
*/
|
||||||
|
|
||||||
|
package compiler.predicates;
|
||||||
|
|
||||||
|
public class TestPeelingFindsUnrelatedOpaque4Node {
|
||||||
|
static int iFld;
|
||||||
|
static boolean flag;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i = 0; i < 1000; i++) {
|
||||||
|
test();
|
||||||
|
flag = !flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test() {
|
||||||
|
String s = flag ? "34323653" : "343423";
|
||||||
|
s.contains("343");
|
||||||
|
// Inlined and will call StringLatin1.indexOf intrinsics which emits Opaque4 node which will be wrongly
|
||||||
|
// found as Template Assertion Predicate when trying to initialize them which triggers the assert.
|
||||||
|
s.contains("3442");
|
||||||
|
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
if (flag) { // Triggers peeling
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
iFld = 34;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user