8314580: PhaseIdealLoop::transform_long_range_checks fails with assert "was tested before"

Reviewed-by: chagedorn, kvn
This commit is contained in:
Roland Westrelin 2023-09-04 15:18:39 +00:00
parent 6c821f5e1d
commit 9def4538ab
2 changed files with 48 additions and 6 deletions

View File

@ -770,7 +770,7 @@ SafePointNode* PhaseIdealLoop::find_safepoint(Node* back_control, Node* x, Ideal
// // inner_incr := AddI(inner_phi, intcon(stride))
// inner_incr = inner_phi + stride;
// if (inner_incr < inner_iters_actual) {
// ... use phi=>(outer_phi+inner_phi) and incr=>(outer_phi+inner_incr) ...
// ... use phi=>(outer_phi+inner_phi) ...
// continue;
// }
// else break;
@ -980,10 +980,6 @@ bool PhaseIdealLoop::create_loop_nest(IdealLoopTree* loop, Node_List &old_new) {
// loop iv phi
Node* iv_add = loop_nest_replace_iv(phi, inner_phi, outer_phi, head, bt);
// Replace inner loop long iv incr with inner loop int incr + outer
// loop iv phi
loop_nest_replace_iv(incr, inner_incr, outer_phi, head, bt);
set_subtree_ctrl(inner_iters_actual_int, body_populated);
LoopNode* inner_head = create_inner_head(loop, head, exit_test);
@ -1032,7 +1028,7 @@ bool PhaseIdealLoop::create_loop_nest(IdealLoopTree* loop, Node_List &old_new) {
// back_control: fallthrough;
// else
// inner_exit_branch: break; //exit_branch->clone()
// ... use phi=>(outer_phi+inner_phi) and incr=>(outer_phi+inner_incr) ...
// ... use phi=>(outer_phi+inner_phi) ...
// inner_phi = inner_phi + stride; // inner_incr
// }
// outer_exit_test: //exit_test->clone(), in(0):=inner_exit_branch

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2023, Red Hat, Inc. 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 8314580
* @summary PhaseIdealLoop::transform_long_range_checks fails with assert "was tested before"
* @run main/othervm -XX:-BackgroundCompilation TestLongRCWithLoopIncr
*
*/
import java.util.Objects;
public class TestLongRCWithLoopIncr {
public static void main(String[] args) {
for (int i = 0; i < 20_000; i++) {
test(1001);
}
}
private static void test(long length) {
for (long i = 0; i < 1000; i++) {
Objects.checkIndex(i + 1, length);
}
}
}