Skip to content
Permalink
Browse files
8261308: C2: assert(inner->is_valid_counted_loop(T_INT) && inner->is_…
…strip_mined()) failed: OuterStripMinedLoop should have been removed

Reviewed-by: chagedorn, kvn
  • Loading branch information
rwestrel committed Mar 1, 2021
1 parent 03d888f commit ddd550ae84a0d02cc23b20cf6f81618f808e369d
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
@@ -124,7 +124,10 @@ void IdealLoopTree::compute_trip_count(PhaseIdealLoop* phase) {
jlong limit_con = (stride_con > 0) ? limit_type->_hi : limit_type->_lo;
int stride_m = stride_con - (stride_con > 0 ? 1 : -1);
jlong trip_count = (limit_con - init_con + stride_m)/stride_con;
if (trip_count > 0 && (julong)trip_count < (julong)max_juint) {
// The loop body is always executed at least once even if init >= limit (for stride_con > 0) or
// init <= limit (for stride_con < 0).
trip_count = MAX2(trip_count, (jlong)1);
if (trip_count < (jlong)max_juint) {
if (init_n->is_Con() && limit_n->is_Con()) {
// Set exact trip count.
cl->set_exact_trip_count((uint)trip_count);
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2021, 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 8261308
* @summary C2: assert(inner->is_valid_counted_loop(T_INT) && inner->is_strip_mined()) failed: OuterStripMinedLoop should have been removed
*
* @run main/othervm -Xcomp -XX:CompileOnly=TestCountedLoopZeroIter TestCountedLoopZeroIter
*
*/


public class TestCountedLoopZeroIter {
static int N = 400;
static boolean b;
static long lArrFld[] = new long[N];
static int iArrFld[] = new int[N];

static void test() {
int i19 = 9, i21 = 8;
long l1;
do
if (!b) {
iArrFld[1] /= l1 = 1;
do {
int i22 = 1;
do {
iArrFld[0] = (int)l1;
iArrFld[i22 - 1] = i21;
} while (++i22 < 1);
lArrFld[1] = i21;
} while (++l1 < 145);
}
while (++i19 < 173);
System.out.println();
}

public static void main(String[] strArr) {
for (int i = 0; i < 10; i++) {
test();
}
}
}

0 comments on commit ddd550a

Please sign in to comment.