From 14beb7bfa687199d1a515889fbc2459d5f6d235b Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 2 Oct 2012 13:30:25 +0200 Subject: [PATCH] isl_ast_build_ast_from_schedule: use "<" if upper bound has negative constant This is a purely cosmetic change. In particular, we prefer for (int c1 = max(0, c0); c1 < min(N, N + c0); c1 += 1) over for (int c1 = max(0, c0); c1 <= min(N - 1, N + c0 - 1); c1 += 1) Signed-off-by: Sven Verdoolaege --- isl_ast_codegen.c | 96 +++++++++++++++++++++++- test_inputs/codegen/cloog/cholesky.c | 4 +- test_inputs/codegen/cloog/cholesky2.c | 4 +- test_inputs/codegen/cloog/christian.c | 4 +- test_inputs/codegen/cloog/classen.c | 2 +- test_inputs/codegen/cloog/dealII.c | 2 +- test_inputs/codegen/cloog/durbin_e_s.c | 4 +- test_inputs/codegen/cloog/equality2.c | 2 +- test_inputs/codegen/cloog/ex1.c | 4 +- test_inputs/codegen/cloog/forwardsub-1-1-2.c | 2 +- test_inputs/codegen/cloog/forwardsub-3-1-2.c | 4 +- test_inputs/codegen/cloog/gauss.c | 4 +- test_inputs/codegen/cloog/gesced2.c | 8 +- test_inputs/codegen/cloog/levenshtein-1-2-3.c | 10 +-- test_inputs/codegen/cloog/lineality-1-2.c | 2 +- test_inputs/codegen/cloog/logo.c | 2 +- test_inputs/codegen/cloog/logopar.c | 2 +- test_inputs/codegen/cloog/lu.c | 2 +- test_inputs/codegen/cloog/lu2.c | 2 +- test_inputs/codegen/cloog/lux.c | 2 +- test_inputs/codegen/cloog/otl.c | 2 +- test_inputs/codegen/cloog/reservoir-QR.c | 28 +++---- test_inputs/codegen/cloog/reservoir-cholesky2.c | 2 +- test_inputs/codegen/cloog/reservoir-jacobi2.c | 4 +- test_inputs/codegen/cloog/reservoir-jacobi3.c | 8 +- test_inputs/codegen/cloog/reservoir-lim-lam2.c | 2 +- test_inputs/codegen/cloog/reservoir-lim-lam3.c | 8 +- test_inputs/codegen/cloog/reservoir-lim-lam4.c | 6 +- test_inputs/codegen/cloog/reservoir-mg-interp.c | 68 ++++++++--------- test_inputs/codegen/cloog/reservoir-mg-interp2.c | 36 ++++----- test_inputs/codegen/cloog/reservoir-mg-psinv.c | 6 +- test_inputs/codegen/cloog/reservoir-mg-resid.c | 6 +- test_inputs/codegen/cloog/reservoir-mg-rprj3.c | 8 +- test_inputs/codegen/cloog/reservoir-pingali1.c | 4 +- test_inputs/codegen/cloog/reservoir-pingali5.c | 8 +- test_inputs/codegen/cloog/reservoir-pingali6.c | 8 +- test_inputs/codegen/cloog/thomasset.c | 2 +- test_inputs/codegen/cloog/usvd_e_t.c | 26 +++---- test_inputs/codegen/cloog/vasilache.c | 8 +- test_inputs/codegen/cloog/vivien.c | 16 ++-- test_inputs/codegen/cloog/vivien2.c | 16 ++-- test_inputs/codegen/cloog/yosr.c | 6 +- test_inputs/codegen/cloog/yosr2.c | 6 +- test_inputs/codegen/omega/chosol-0.c | 2 +- test_inputs/codegen/omega/chosol-1.c | 2 +- test_inputs/codegen/omega/code_gen-1.c | 2 +- test_inputs/codegen/omega/code_gen-2.c | 2 +- test_inputs/codegen/omega/collard-0.c | 6 +- test_inputs/codegen/omega/fc1-0.c | 6 +- test_inputs/codegen/omega/fc1-1.c | 8 +- test_inputs/codegen/omega/fc1-2.c | 8 +- test_inputs/codegen/omega/fc2-0.c | 6 +- test_inputs/codegen/omega/fc2-1.c | 8 +- test_inputs/codegen/omega/ge-0.c | 2 +- test_inputs/codegen/omega/ge-1.c | 2 +- test_inputs/codegen/omega/gist-3.c | 2 +- test_inputs/codegen/omega/lu-0.c | 2 +- test_inputs/codegen/omega/lu-1.c | 2 +- test_inputs/codegen/omega/lu-2.c | 2 +- test_inputs/codegen/omega/lu-3.c | 2 +- test_inputs/codegen/omega/lu_ijk-0.c | 2 +- test_inputs/codegen/omega/lu_ijk-1.c | 2 +- test_inputs/codegen/omega/lu_ijk-2.c | 4 +- test_inputs/codegen/omega/olda-1.c | 2 +- test_inputs/codegen/omega/ts1d-check-sblock-0.c | 2 +- test_inputs/codegen/omega/ts1d-check0-0.c | 2 +- test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c | 6 +- test_inputs/codegen/omega/ts1d-orig0-0.c | 8 +- 68 files changed, 316 insertions(+), 222 deletions(-) rewrite test_inputs/codegen/cloog/reservoir-mg-interp2.c (83%) diff --git a/isl_ast_codegen.c b/isl_ast_codegen.c index c0afa0ae..7679760c 100644 --- a/isl_ast_codegen.c +++ b/isl_ast_codegen.c @@ -716,27 +716,121 @@ static __isl_give isl_ast_graft *set_enforced_from_list( return graft; } +/* Does "aff" have a negative constant term? + */ +static int aff_constant_is_negative(__isl_take isl_set *set, + __isl_take isl_aff *aff, void *user) +{ + int *neg = user; + isl_int v; + + isl_int_init(v); + isl_aff_get_constant(aff, &v); + *neg = isl_int_is_neg(v); + isl_int_clear(v); + isl_set_free(set); + isl_aff_free(aff); + + return *neg ? 0 : -1; +} + +/* Does "pa" have a negative constant term over its entire domain? + */ +static int pw_aff_constant_is_negative(__isl_take isl_pw_aff *pa, void *user) +{ + int r; + int *neg = user; + + r = isl_pw_aff_foreach_piece(pa, &aff_constant_is_negative, user); + isl_pw_aff_free(pa); + + return *neg ? 0 : -1; +} + +/* Does each element in "list" have a negative constant term? + * + * The callback terminates the iteration as soon an element has been + * found that does not have a negative constant term. + */ +static int list_constant_is_negative(__isl_keep isl_pw_aff_list *list) +{ + int neg = 1; + + if (isl_pw_aff_list_foreach(list, + &pw_aff_constant_is_negative, &neg) < 0 && neg) + return -1; + + return neg; +} + +/* Add 1 to each of the elements in "list", where each of these elements + * is defined over the internal schedule space of "build". + */ +static __isl_give isl_pw_aff_list *list_add_one( + __isl_take isl_pw_aff_list *list, __isl_keep isl_ast_build *build) +{ + int i, n; + isl_space *space; + isl_aff *aff; + isl_pw_aff *one; + + space = isl_ast_build_get_space(build, 1); + aff = isl_aff_zero_on_domain(isl_local_space_from_space(space)); + aff = isl_aff_add_constant_si(aff, 1); + one = isl_pw_aff_from_aff(aff); + + n = isl_pw_aff_list_n_pw_aff(list); + for (i = 0; i < n; ++i) { + isl_pw_aff *pa; + pa = isl_pw_aff_list_get_pw_aff(list, i); + pa = isl_pw_aff_add(pa, isl_pw_aff_copy(one)); + list = isl_pw_aff_list_set_pw_aff(list, i, pa); + } + + isl_pw_aff_free(one); + + return list; +} + /* Set the condition part of the for node graft->node in case * the upper bound is represented as a list of piecewise affine expressions. * * In particular, set the condition to * * iterator <= min(list of upper bounds) + * + * If each of the upper bounds has a negative constant term, then + * set the condition to + * + * iterator < min(list of (upper bound + 1)s) + * */ static __isl_give isl_ast_graft *set_for_cond_from_list( __isl_take isl_ast_graft *graft, __isl_keep isl_pw_aff_list *list, __isl_keep isl_ast_build *build) { + int neg; isl_ast_expr *bound, *iterator, *cond; + enum isl_ast_op_type type = isl_ast_op_le; if (!graft || !list) return isl_ast_graft_free(graft); + neg = list_constant_is_negative(list); + if (neg < 0) + return isl_ast_graft_free(graft); + list = isl_pw_aff_list_copy(list); + if (neg) { + list = list_add_one(list, build); + type = isl_ast_op_lt; + } + bound = reduce_list(isl_ast_op_min, list, build); iterator = isl_ast_expr_copy(graft->node->u.f.iterator); - cond = isl_ast_expr_alloc_binary(isl_ast_op_le, iterator, bound); + cond = isl_ast_expr_alloc_binary(type, iterator, bound); graft->node->u.f.cond = cond; + isl_pw_aff_list_free(list); if (!graft->node->u.f.cond) return isl_ast_graft_free(graft); return graft; diff --git a/test_inputs/codegen/cloog/cholesky.c b/test_inputs/codegen/cloog/cholesky.c index 5a3d147b..20d4e4d0 100644 --- a/test_inputs/codegen/cloog/cholesky.c +++ b/test_inputs/codegen/cloog/cholesky.c @@ -1,11 +1,11 @@ for (int c0 = 1; c0 <= n; c0 += 1) { S1(c0); - for (int c2 = 1; c2 <= c0 - 1; c2 += 1) + for (int c2 = 1; c2 < c0; c2 += 1) S2(c0, c2); S3(c0); for (int c2 = c0 + 1; c2 <= n; c2 += 1) { S4(c0, c2); - for (int c4 = 1; c4 <= c0 - 1; c4 += 1) + for (int c4 = 1; c4 < c0; c4 += 1) S5(c0, c2, c4); S6(c0, c2); } diff --git a/test_inputs/codegen/cloog/cholesky2.c b/test_inputs/codegen/cloog/cholesky2.c index 56eb72e2..7834ff49 100644 --- a/test_inputs/codegen/cloog/cholesky2.c +++ b/test_inputs/codegen/cloog/cholesky2.c @@ -4,11 +4,11 @@ for (int c2 = c1 + 1; c2 <= M; c2 += 1) S4(c1, c2); } - for (int c0 = 1; c0 <= 3 * M - 2; c0 += 3) { + for (int c0 = 1; c0 < 3 * M - 1; c0 += 3) { S3((c0 + 2) / 3); for (int c1 = (c0 + 5) / 3; c1 <= M; c1 += 1) { S6((c0 + 2) / 3, c1); - for (int c4 = (c0 + 5) / 3; c4 <= c1 - 1; c4 += 1) + for (int c4 = (c0 + 5) / 3; c4 < c1; c4 += 1) S5(c4, c1, (c0 + 2) / 3); } for (int c1 = (c0 + 5) / 3; c1 <= M; c1 += 1) diff --git a/test_inputs/codegen/cloog/christian.c b/test_inputs/codegen/cloog/christian.c index 79ca949f..9c69a4b3 100644 --- a/test_inputs/codegen/cloog/christian.c +++ b/test_inputs/codegen/cloog/christian.c @@ -1,6 +1,6 @@ for (int c0 = -N + 1; c0 <= N; c0 += 1) { - for (int c1 = max(0, c0); c1 <= min(N - 1, N + c0 - 1); c1 += 1) + for (int c1 = max(0, c0); c1 < min(N, N + c0); c1 += 1) S1(c1, -c0 + c1); - for (int c1 = max(c0 - 1, 0); c1 <= min(N + c0 - 2, N - 1); c1 += 1) + for (int c1 = max(c0 - 1, 0); c1 < min(N + c0 - 1, N); c1 += 1) S2(c1, -c0 + c1 + 1); } diff --git a/test_inputs/codegen/cloog/classen.c b/test_inputs/codegen/cloog/classen.c index 9df75c78..ec3a1f4a 100644 --- a/test_inputs/codegen/cloog/classen.c +++ b/test_inputs/codegen/cloog/classen.c @@ -9,7 +9,7 @@ S2(0, 1, 1, 1, 1, 1, 2, 1); S8(0, 1); } - for (int c0 = 1; c0 <= 2 * m - 4; c0 += 1) { + for (int c0 = 1; c0 < 2 * m - 3; c0 += 1) { if (c0 + 1 == m) { S5(m - 2, 1, m - 1, 1, m - 1, 1, m, 1); S1(m - 1, 1, m, 1); diff --git a/test_inputs/codegen/cloog/dealII.c b/test_inputs/codegen/cloog/dealII.c index 87a8098c..92fd6403 100644 --- a/test_inputs/codegen/cloog/dealII.c +++ b/test_inputs/codegen/cloog/dealII.c @@ -3,7 +3,7 @@ S1(c0); S2(c0); } - for (int c0 = max(T_66 + 1, 0); c0 <= T_2 - 1; c0 += 1) + for (int c0 = max(T_66 + 1, 0); c0 < T_2; c0 += 1) S1(c0); if (T_67 == 0 && T_2 == 0) S1(0); diff --git a/test_inputs/codegen/cloog/durbin_e_s.c b/test_inputs/codegen/cloog/durbin_e_s.c index a47d3197..25590998 100644 --- a/test_inputs/codegen/cloog/durbin_e_s.c +++ b/test_inputs/codegen/cloog/durbin_e_s.c @@ -4,11 +4,11 @@ S8(1, 0, 3); for (int c0 = 2; c0 <= 9; c0 += 1) { S2(c0, -7, 0); - for (int c1 = -7; c1 <= c0 - 9; c1 += 1) + for (int c1 = -7; c1 < c0 - 8; c1 += 1) S3(c0, c1, 1); S6(c0, c0 - 9, 2); S8(c0, 0, 3); - for (int c1 = 1; c1 <= c0 - 1; c1 += 1) + for (int c1 = 1; c1 < c0; c1 += 1) S5(c0, c1, 3); } S2(10, -7, 0); diff --git a/test_inputs/codegen/cloog/equality2.c b/test_inputs/codegen/cloog/equality2.c index a9d2d9cd..12d8c037 100644 --- a/test_inputs/codegen/cloog/equality2.c +++ b/test_inputs/codegen/cloog/equality2.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= 10000; c0 += 1) for (int c1 = 1000; c1 <= 1016; c1 += 1) - for (int c2 = 1; c2 <= 2 * c1 - 1999; c2 += 1) { + for (int c2 = 1; c2 < 2 * c1 - 1998; c2 += 1) { if (c2 + 1999 == 2 * c1 && c1 <= 1008) S2(c0, c1, 2 * c1 - 1999, 1, c0, 2 * c1 - 1000, 1, 2, c0, c1 - 499, 2 * c1 - 1999, c0, 2 * c1 - 1999, c1 - 999, c1 - 999); if (c1 % 2 == 0 && c2 == 1) diff --git a/test_inputs/codegen/cloog/ex1.c b/test_inputs/codegen/cloog/ex1.c index 36ac7d98..2627f23d 100644 --- a/test_inputs/codegen/cloog/ex1.c +++ b/test_inputs/codegen/cloog/ex1.c @@ -1,11 +1,11 @@ { for (int c0 = 0; c0 <= 14; c0 += 1) - for (int c1 = 0; c1 <= n - 15; c1 += 1) + for (int c1 = 0; c1 < n - 14; c1 += 1) S1(c0, c1); for (int c0 = 15; c0 <= n; c0 += 1) { for (int c1 = 0; c1 <= 9; c1 += 1) S1(c0, c1); - for (int c1 = 10; c1 <= n - 15; c1 += 1) { + for (int c1 = 10; c1 < n - 14; c1 += 1) { S1(c0, c1); S2(c0, c1); } diff --git a/test_inputs/codegen/cloog/forwardsub-1-1-2.c b/test_inputs/codegen/cloog/forwardsub-1-1-2.c index ac071b45..45fe75ef 100644 --- a/test_inputs/codegen/cloog/forwardsub-1-1-2.c +++ b/test_inputs/codegen/cloog/forwardsub-1-1-2.c @@ -2,7 +2,7 @@ S3(1, 1); for (int c0 = 2; c0 <= M; c0 += 1) { S1(c0, 1); - for (int c1 = 2; c1 <= c0 - 1; c1 += 1) + for (int c1 = 2; c1 < c0; c1 += 1) S2(c0, c1); S4(c0, c0); } diff --git a/test_inputs/codegen/cloog/forwardsub-3-1-2.c b/test_inputs/codegen/cloog/forwardsub-3-1-2.c index d84fae8d..9300d189 100644 --- a/test_inputs/codegen/cloog/forwardsub-3-1-2.c +++ b/test_inputs/codegen/cloog/forwardsub-3-1-2.c @@ -3,13 +3,13 @@ S1(3, 1); for (int c0 = 4; c0 <= M + 1; c0 += 1) { S1(c0, 1); - for (int c1 = 2; c1 <= (c0 + 1) / 2 - 1; c1 += 1) + for (int c1 = 2; c1 < (c0 + 1) / 2; c1 += 1) S2(c0, c1); if (c0 % 2 == 0) S4(c0, c0 / 2); } for (int c0 = M + 2; c0 <= 2 * M; c0 += 1) { - for (int c1 = -M + c0; c1 <= (c0 + 1) / 2 - 1; c1 += 1) + for (int c1 = -M + c0; c1 < (c0 + 1) / 2; c1 += 1) S2(c0, c1); if (c0 % 2 == 0) S4(c0, c0 / 2); diff --git a/test_inputs/codegen/cloog/gauss.c b/test_inputs/codegen/cloog/gauss.c index 7b7a4312..4bbe42cb 100644 --- a/test_inputs/codegen/cloog/gauss.c +++ b/test_inputs/codegen/cloog/gauss.c @@ -1,6 +1,6 @@ -for (int c0 = 1; c0 <= M - 1; c0 += 1) +for (int c0 = 1; c0 < M; c0 += 1) for (int c1 = c0 + 1; c1 <= M; c1 += 1) { - for (int c3 = 1; c3 <= c0 - 1; c3 += 1) + for (int c3 = 1; c3 < c0; c3 += 1) S1(c0, c3, c1); for (int c3 = c0 + 1; c3 <= M; c3 += 1) S2(c0, c3, c1); diff --git a/test_inputs/codegen/cloog/gesced2.c b/test_inputs/codegen/cloog/gesced2.c index a0fa2bf2..4b0efdb5 100644 --- a/test_inputs/codegen/cloog/gesced2.c +++ b/test_inputs/codegen/cloog/gesced2.c @@ -1,20 +1,20 @@ { for (int c0 = 1; c0 <= 4; c0 += 1) - for (int c1 = 5; c1 <= M - 10; c1 += 1) + for (int c1 = 5; c1 < M - 9; c1 += 1) S1(c0, c1); - for (int c0 = 5; c0 <= M - 10; c0 += 1) { + for (int c0 = 5; c0 < M - 9; c0 += 1) { for (int c1 = -c0 + 1; c1 <= 4; c1 += 1) S2(c0 + c1, c0); for (int c1 = 5; c1 <= min(M - c0, M - 10); c1 += 1) { S1(c0, c1); S2(c0 + c1, c0); } - for (int c1 = M - c0 + 1; c1 <= M - 10; c1 += 1) + for (int c1 = M - c0 + 1; c1 < M - 9; c1 += 1) S1(c0, c1); for (int c1 = M - 9; c1 <= M - c0; c1 += 1) S2(c0 + c1, c0); } for (int c0 = M - 9; c0 <= M; c0 += 1) - for (int c1 = 5; c1 <= M - 10; c1 += 1) + for (int c1 = 5; c1 < M - 9; c1 += 1) S1(c0, c1); } diff --git a/test_inputs/codegen/cloog/levenshtein-1-2-3.c b/test_inputs/codegen/cloog/levenshtein-1-2-3.c index 627eab79..6929d18f 100644 --- a/test_inputs/codegen/cloog/levenshtein-1-2-3.c +++ b/test_inputs/codegen/cloog/levenshtein-1-2-3.c @@ -2,7 +2,7 @@ S1(0, 0); for (int c0 = 1; c0 <= N; c0 += 1) { S2(c0, 0); - for (int c1 = 1; c1 <= c0 - 1; c1 += 1) + for (int c1 = 1; c1 < c0; c1 += 1) S6(c0, c1); S3(c0, c0); } @@ -11,13 +11,13 @@ S6(N + 1, c1); S8(N + 1, c1); } - for (int c0 = N + 2; c0 <= 2 * M - N - 2; c0 += 1) { + for (int c0 = N + 2; c0 < 2 * M - N - 1; c0 += 1) { S7(c0, -N + (N + c0 + 1) / 2 - 1); if ((-N + c0) % 2 == 0) { S5(c0, (-N + c0) / 2); S8(c0, (-N + c0) / 2); } - for (int c1 = c0 - (N + c0 + 1) / 2 + 1; c1 <= (N + c0 + 1) / 2 - 1; c1 += 1) { + for (int c1 = c0 - (N + c0 + 1) / 2 + 1; c1 < (N + c0 + 1) / 2; c1 += 1) { S6(c0, c1); S8(c0, c1); } @@ -26,7 +26,7 @@ S8(c0, (N + c0) / 2); } } - for (int c0 = 2 * M - N - 1; c0 <= 2 * M - 2; c0 += 1) - for (int c1 = -M + c0 + 1; c1 <= M - 1; c1 += 1) + for (int c0 = 2 * M - N - 1; c0 < 2 * M - 1; c0 += 1) + for (int c1 = -M + c0 + 1; c1 < M; c1 += 1) S6(c0, c1); } diff --git a/test_inputs/codegen/cloog/lineality-1-2.c b/test_inputs/codegen/cloog/lineality-1-2.c index b2921f12..bb1e0718 100644 --- a/test_inputs/codegen/cloog/lineality-1-2.c +++ b/test_inputs/codegen/cloog/lineality-1-2.c @@ -1,5 +1,5 @@ for (int c0 = 1; c0 <= M; c0 += 1) { - for (int c1 = 1; c1 <= c0 - 1; c1 += 1) + for (int c1 = 1; c1 < c0; c1 += 1) S1(c0, c1); S1(c0, c0); S2(c0, c0); diff --git a/test_inputs/codegen/cloog/logo.c b/test_inputs/codegen/cloog/logo.c index ea2a3c1b..abe35b59 100644 --- a/test_inputs/codegen/cloog/logo.c +++ b/test_inputs/codegen/cloog/logo.c @@ -2,7 +2,7 @@ for (int c1 = 0; c1 <= 7; c1 += 1) S1(1, c1); for (int c0 = 2; c0 <= 6; c0 += 1) { - for (int c1 = 0; c1 <= c0 - 2; c1 += 1) + for (int c1 = 0; c1 < c0 - 1; c1 += 1) S2(c0, c1); for (int c1 = c0 - 1; c1 <= 4; c1 += 1) { S1(c0, c1); diff --git a/test_inputs/codegen/cloog/logopar.c b/test_inputs/codegen/cloog/logopar.c index e3873577..70f98e8c 100644 --- a/test_inputs/codegen/cloog/logopar.c +++ b/test_inputs/codegen/cloog/logopar.c @@ -2,7 +2,7 @@ for (int c1 = 0; c1 <= m; c1 += 1) S1(1, c1); for (int c0 = 2; c0 <= n; c0 += 1) { - for (int c1 = 0; c1 <= c0 - 2; c1 += 1) + for (int c1 = 0; c1 < c0 - 1; c1 += 1) S2(c0, c1); for (int c1 = c0 - 1; c1 <= n; c1 += 1) { S1(c0, c1); diff --git a/test_inputs/codegen/cloog/lu.c b/test_inputs/codegen/cloog/lu.c index 9159b1b1..a7fe2b36 100644 --- a/test_inputs/codegen/cloog/lu.c +++ b/test_inputs/codegen/cloog/lu.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= n; c0 += 1) { for (int c1 = 2; c1 <= n; c1 += 1) - for (int c2 = 1; c2 <= min(c0 - 1, c1 - 1); c2 += 1) + for (int c2 = 1; c2 < min(c0, c1); c2 += 1) S2(c2, c1, c0); for (int c3 = c0 + 1; c3 <= n; c3 += 1) S1(c0, c3); diff --git a/test_inputs/codegen/cloog/lu2.c b/test_inputs/codegen/cloog/lu2.c index 46fce503..d5cc9123 100644 --- a/test_inputs/codegen/cloog/lu2.c +++ b/test_inputs/codegen/cloog/lu2.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= n; c0 += 1) { for (int c1 = 2; c1 <= n; c1 += 1) - for (int c2 = 1; c2 <= min(c0 - 1, c1 - 1); c2 += 1) + for (int c2 = 1; c2 < min(c0, c1); c2 += 1) S2(c0, c1, c2, c1, c0); for (int c3 = c0 + 1; c3 <= n; c3 += 1) S1(c0, n, c0, c3); diff --git a/test_inputs/codegen/cloog/lux.c b/test_inputs/codegen/cloog/lux.c index 68cf881c..3b33025e 100644 --- a/test_inputs/codegen/cloog/lux.c +++ b/test_inputs/codegen/cloog/lux.c @@ -1,5 +1,5 @@ for (int c0 = 1; c0 <= M; c0 += 1) { - for (int c1 = 1; c1 <= c0 - 1; c1 += 1) + for (int c1 = 1; c1 < c0; c1 += 1) for (int c2 = c1 + 1; c2 <= M; c2 += 1) S2(c0, c1, c2, c2, c0); for (int c3 = c0 + 1; c3 <= M; c3 += 1) diff --git a/test_inputs/codegen/cloog/otl.c b/test_inputs/codegen/cloog/otl.c index 202f37bb..d0848ca1 100644 --- a/test_inputs/codegen/cloog/otl.c +++ b/test_inputs/codegen/cloog/otl.c @@ -1,5 +1,5 @@ if (M >= 3 && N >= 4) - for (int c0 = 1; c0 <= (2 * M + 2 * N - 2) / 5 - 1; c0 += 1) + for (int c0 = 1; c0 < (2 * M + 2 * N - 2) / 5; c0 += 1) for (int c1 = max(c0 - c0 / 2, c0 - (M + 2) / 5); c1 <= min(min((2 * N + 5 * c0 + 1) / 10, c0), (M + 2 * N) / 5 - 1); c1 += 1) for (int c2 = max(max(max(max(c0 - (N + 5 * c0 + 2) / 10, c1 - (N + 1) / 5), c0 - c1 - 1), 0), c0 - (M + N - 1) / 5); c2 <= min(min(min(c0 - c1 + (N - 1) / 5 + 1, (N + 5 * c0 + 3) / 10), c1), (M + N - 2) / 5); c2 += 1) for (int c3 = max(max(max(c1 + c2 - (N - 2) / 5 - 1, 2 * c2 - (N + 2) / 5), 2 * c1 - 2 * N / 5), c0); c3 <= min(min(min(min(min(c0 + 1, c1 + c2 + 1), c2 + (M + N) / 5), (2 * M + 2 * N - 1) / 5 - 1), c1 + (M - 2) / 5 + 1), 2 * c2 + (N - 2) / 5 + 1); c3 += 1) diff --git a/test_inputs/codegen/cloog/reservoir-QR.c b/test_inputs/codegen/cloog/reservoir-QR.c index 2b533dd7..253791a5 100644 --- a/test_inputs/codegen/cloog/reservoir-QR.c +++ b/test_inputs/codegen/cloog/reservoir-QR.c @@ -1,36 +1,36 @@ if (N >= 1) { S1(0); if (N == 1) { - for (int c3 = 0; c3 <= M - 1; c3 += 1) + for (int c3 = 0; c3 < M; c3 += 1) S2(0, c3); S3(0); - for (int c3 = 0; c3 <= M - 1; c3 += 1) + for (int c3 = 0; c3 < M; c3 += 1) S4(0, c3); S10(0); S5(0); } else { - for (int c3 = 0; c3 <= M - 1; c3 += 1) + for (int c3 = 0; c3 < M; c3 += 1) S2(0, c3); S3(0); - for (int c3 = 0; c3 <= M - 1; c3 += 1) + for (int c3 = 0; c3 < M; c3 += 1) S4(0, c3); S10(0); S1(1); S5(0); } - for (int c1 = 2; c1 <= N - 1; c1 += 1) { - for (int c3 = c1 - 1; c3 <= N - 1; c3 += 1) { + for (int c1 = 2; c1 < N; c1 += 1) { + for (int c3 = c1 - 1; c3 < N; c3 += 1) { S6(c1 - 2, c3); - for (int c5 = c1 - 2; c5 <= M - 1; c5 += 1) + for (int c5 = c1 - 2; c5 < M; c5 += 1) S7(c1 - 2, c3, c5); S8(c1 - 2, c3); - for (int c5 = c1 - 2; c5 <= M - 1; c5 += 1) + for (int c5 = c1 - 2; c5 < M; c5 += 1) S9(c1 - 2, c3, c5); } - for (int c3 = c1 - 1; c3 <= M - 1; c3 += 1) + for (int c3 = c1 - 1; c3 < M; c3 += 1) S2(c1 - 1, c3); S3(c1 - 1); - for (int c3 = c1 - 1; c3 <= M - 1; c3 += 1) + for (int c3 = c1 - 1; c3 < M; c3 += 1) S4(c1 - 1, c3); S10(c1 - 1); S1(c1); @@ -38,15 +38,15 @@ if (N >= 1) { } if (N >= 2) { S6(N - 2, N - 1); - for (int c5 = N - 2; c5 <= M - 1; c5 += 1) + for (int c5 = N - 2; c5 < M; c5 += 1) S7(N - 2, N - 1, c5); S8(N - 2, N - 1); - for (int c5 = N - 2; c5 <= M - 1; c5 += 1) + for (int c5 = N - 2; c5 < M; c5 += 1) S9(N - 2, N - 1, c5); - for (int c3 = N - 1; c3 <= M - 1; c3 += 1) + for (int c3 = N - 1; c3 < M; c3 += 1) S2(N - 1, c3); S3(N - 1); - for (int c3 = N - 1; c3 <= M - 1; c3 += 1) + for (int c3 = N - 1; c3 < M; c3 += 1) S4(N - 1, c3); S10(N - 1); S5(N - 1); diff --git a/test_inputs/codegen/cloog/reservoir-cholesky2.c b/test_inputs/codegen/cloog/reservoir-cholesky2.c index d4975248..5d90323e 100644 --- a/test_inputs/codegen/cloog/reservoir-cholesky2.c +++ b/test_inputs/codegen/cloog/reservoir-cholesky2.c @@ -1,4 +1,4 @@ -for (int c1 = 2; c1 <= 3 * M - 1; c1 += 1) { +for (int c1 = 2; c1 < 3 * M; c1 += 1) { if ((c1 - 2) % 3 == 0) S1((c1 + 1) / 3); for (int c3 = (c1 + 1) / 3 + 1; c3 <= min(c1 - 2, M); c3 += 1) diff --git a/test_inputs/codegen/cloog/reservoir-jacobi2.c b/test_inputs/codegen/cloog/reservoir-jacobi2.c index 44b46eeb..407fc8b7 100644 --- a/test_inputs/codegen/cloog/reservoir-jacobi2.c +++ b/test_inputs/codegen/cloog/reservoir-jacobi2.c @@ -1,3 +1,3 @@ -for (int c1 = 0; c1 <= M - 1; c1 += 1) - for (int c3 = 0; c3 <= M - 1; c3 += 1) +for (int c1 = 0; c1 < M; c1 += 1) + for (int c3 = 0; c3 < M; c3 += 1) S1(c1, c3); diff --git a/test_inputs/codegen/cloog/reservoir-jacobi3.c b/test_inputs/codegen/cloog/reservoir-jacobi3.c index 011b912c..1df9bb90 100644 --- a/test_inputs/codegen/cloog/reservoir-jacobi3.c +++ b/test_inputs/codegen/cloog/reservoir-jacobi3.c @@ -1,8 +1,8 @@ for (int c1 = 1; c1 <= M; c1 += 1) { - for (int c3 = 2; c3 <= N - 1; c3 += 1) - for (int c5 = 2; c5 <= N - 1; c5 += 1) + for (int c3 = 2; c3 < N; c3 += 1) + for (int c5 = 2; c5 < N; c5 += 1) S1(c1, c3, c5); - for (int c3 = 2; c3 <= N - 1; c3 += 1) - for (int c5 = 2; c5 <= N - 1; c5 += 1) + for (int c3 = 2; c3 < N; c3 += 1) + for (int c5 = 2; c5 < N; c5 += 1) S2(c1, c3, c5); } diff --git a/test_inputs/codegen/cloog/reservoir-lim-lam2.c b/test_inputs/codegen/cloog/reservoir-lim-lam2.c index 5c8481c8..f3215bf6 100644 --- a/test_inputs/codegen/cloog/reservoir-lim-lam2.c +++ b/test_inputs/codegen/cloog/reservoir-lim-lam2.c @@ -5,6 +5,6 @@ for (int c3 = 2; c3 <= N; c3 += 1) S2(c1, c3); for (int c1 = 1; c1 <= M; c1 += 1) - for (int c3 = 1; c3 <= N - 1; c3 += 1) + for (int c3 = 1; c3 < N; c3 += 1) S3(c1, c3); } diff --git a/test_inputs/codegen/cloog/reservoir-lim-lam3.c b/test_inputs/codegen/cloog/reservoir-lim-lam3.c index 14475f83..bd64f099 100644 --- a/test_inputs/codegen/cloog/reservoir-lim-lam3.c +++ b/test_inputs/codegen/cloog/reservoir-lim-lam3.c @@ -1,11 +1,11 @@ for (int c1 = 5; c1 <= 5 * M; c1 += 1) { - for (int c3 = max(2, -floord(M - c1 - 1, 4) - 1); c3 <= min((c1 + 1) / 3 - 3, M - 1); c3 += 1) - for (int c5 = max(c1 - c3 - (M + c1 + 1) / 2 - 2, 1); c5 <= min(c3 - 1, -2 * c3 + (c1 + c3) / 2 - 3); c5 += 1) + for (int c3 = max(2, -floord(M - c1 - 1, 4) - 1); c3 < min((c1 + 1) / 3 - 2, M); c3 += 1) + for (int c5 = max(c1 - c3 - (M + c1 + 1) / 2 - 2, 1); c5 < min(c3, -2 * c3 + (c1 + c3) / 2 - 2); c5 += 1) S1(c1 - 2 * c3 - 2 * c5 - 5, c3, c5); - for (int c3 = max(1, -floord(M - c1 - 1, 4) - 1); c3 <= (c1 + 1) / 5 - 1; c3 += 1) + for (int c3 = max(1, -floord(M - c1 - 1, 4) - 1); c3 < (c1 + 1) / 5; c3 += 1) S2(c1 - 4 * c3 - 3, c3); if (c1 % 5 == 0) S4(c1 / 5); - for (int c3 = max(-((c1 + 2) % 3) + 3, 2 * c1 - 3 * ((M + c1 + 1) / 2) + 1); c3 <= (c1 + 1) / 5 - 1; c3 += 3) + for (int c3 = max(-((c1 + 2) % 3) + 3, 2 * c1 - 3 * ((M + c1 + 1) / 2) + 1); c3 < (c1 + 1) / 5; c3 += 3) S3((c1 - 2 * c3 - 1) / 3, c3); } diff --git a/test_inputs/codegen/cloog/reservoir-lim-lam4.c b/test_inputs/codegen/cloog/reservoir-lim-lam4.c index 73603e68..84278864 100644 --- a/test_inputs/codegen/cloog/reservoir-lim-lam4.c +++ b/test_inputs/codegen/cloog/reservoir-lim-lam4.c @@ -1,8 +1,8 @@ -for (int c1 = 1; c1 <= 2 * M - 2; c1 += 1) { - for (int c3 = max(-c1 + 1, -M + 1); c3 <= -1; c3 += 1) { +for (int c1 = 1; c1 < 2 * M - 1; c1 += 1) { + for (int c3 = max(-c1 + 1, -M + 1); c3 < 0; c3 += 1) { for (int c7 = max(-M + c1 + 1, 1); c7 <= min(c1 + c3, M - 1); c7 += 1) S1(c7, c1 + c3 - c7, -c3); - for (int c5 = max(-c3, -M + c1 + 1); c5 <= min(M - 1, c1 - 1); c5 += 1) + for (int c5 = max(-c3, -M + c1 + 1); c5 < min(M, c1); c5 += 1) S2(c1 - c5, c3 + c5, c5); } for (int c7 = max(1, -M + c1 + 1); c7 <= min(c1, M - 1); c7 += 1) diff --git a/test_inputs/codegen/cloog/reservoir-mg-interp.c b/test_inputs/codegen/cloog/reservoir-mg-interp.c index 697c8492..cff8f172 100644 --- a/test_inputs/codegen/cloog/reservoir-mg-interp.c +++ b/test_inputs/codegen/cloog/reservoir-mg-interp.c @@ -1,9 +1,9 @@ { if (N >= 2) - for (int c1 = 1; c1 <= O - 1; c1 += 1) { + for (int c1 = 1; c1 < O; c1 += 1) { for (int c5 = 1; c5 <= M; c5 += 1) S1(c1, 1, c5); - for (int c5 = 1; c5 <= M - 1; c5 += 1) { + for (int c5 = 1; c5 < M; c5 += 1) { S6(c1, 1, c5); S7(c1, 1, c5); } @@ -12,74 +12,74 @@ S3(c1, 1, c5); for (int c5 = 1; c5 <= M; c5 += 1) S1(c1, 2, c5); - for (int c5 = 1; c5 <= M - 1; c5 += 1) { + for (int c5 = 1; c5 < M; c5 += 1) { S6(c1, 2, c5); S7(c1, 2, c5); } - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S11(c1, 1, c5); } else { for (int c5 = 1; c5 <= M; c5 += 1) S3(c1, 1, c5); - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S11(c1, 1, c5); } - for (int c3 = 3; c3 <= 2 * N - 5; c3 += 2) { - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c3 = 3; c3 < 2 * N - 4; c3 += 2) { + for (int c5 = 1; c5 < M; c5 += 1) S10(c1, (c3 - 1) / 2, c5); for (int c5 = 1; c5 <= M; c5 += 1) S3(c1, (c3 + 1) / 2, c5); for (int c5 = 1; c5 <= M; c5 += 1) S1(c1, (c3 + 3) / 2, c5); - for (int c5 = 1; c5 <= M - 1; c5 += 1) { + for (int c5 = 1; c5 < M; c5 += 1) { S6(c1, (c3 + 3) / 2, c5); S7(c1, (c3 + 3) / 2, c5); } - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S11(c1, (c3 + 1) / 2, c5); } if (N >= 3) { - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S10(c1, N - 2, c5); for (int c5 = 1; c5 <= M; c5 += 1) S3(c1, N - 1, c5); - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S11(c1, N - 1, c5); } - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S10(c1, N - 1, c5); } - for (int c1 = 1; c1 <= O - 1; c1 += 1) - for (int c3 = 1; c3 <= N - 1; c3 += 1) { + for (int c1 = 1; c1 < O; c1 += 1) + for (int c3 = 1; c3 < N; c3 += 1) { for (int c5 = 1; c5 <= M; c5 += 1) S2(c1, c3, c5); - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S8(c1, c3, c5); - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S9(c1, c3, c5); } - for (int c1 = 1; c1 <= O - 1; c1 += 1) - for (int c3 = 1; c3 <= N - 1; c3 += 1) - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c1 = 1; c1 < O; c1 += 1) + for (int c3 = 1; c3 < N; c3 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S4(c1, c3, c5); - for (int c1 = 1; c1 <= O - 1; c1 += 1) - for (int c3 = 1; c3 <= N - 1; c3 += 1) - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c1 = 1; c1 < O; c1 += 1) + for (int c3 = 1; c3 < N; c3 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S5(c1, c3, c5); - for (int c1 = R; c1 <= O - 1; c1 += 1) - for (int c3 = Q; c3 <= N - 1; c3 += 1) - for (int c5 = P; c5 <= M - 1; c5 += 1) + for (int c1 = R; c1 < O; c1 += 1) + for (int c3 = Q; c3 < N; c3 += 1) + for (int c5 = P; c5 < M; c5 += 1) S12(c1, c3, c5); - for (int c1 = R; c1 <= O - 1; c1 += 1) - for (int c3 = Q; c3 <= N - 1; c3 += 1) - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c1 = R; c1 < O; c1 += 1) + for (int c3 = Q; c3 < N; c3 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S13(c1, c3, c5); - for (int c1 = R; c1 <= O - 1; c1 += 1) - for (int c3 = 1; c3 <= N - 1; c3 += 1) - for (int c5 = P; c5 <= M - 1; c5 += 1) + for (int c1 = R; c1 < O; c1 += 1) + for (int c3 = 1; c3 < N; c3 += 1) + for (int c5 = P; c5 < M; c5 += 1) S14(c1, c3, c5); - for (int c1 = R; c1 <= O - 1; c1 += 1) - for (int c3 = 1; c3 <= N - 1; c3 += 1) - for (int c5 = 1; c5 <= M - 1; c5 += 1) + for (int c1 = R; c1 < O; c1 += 1) + for (int c3 = 1; c3 < N; c3 += 1) + for (int c5 = 1; c5 < M; c5 += 1) S15(c1, c3, c5); } diff --git a/test_inputs/codegen/cloog/reservoir-mg-interp2.c b/test_inputs/codegen/cloog/reservoir-mg-interp2.c dissimilarity index 83% index 5a8a4fcc..98cd4b07 100644 --- a/test_inputs/codegen/cloog/reservoir-mg-interp2.c +++ b/test_inputs/codegen/cloog/reservoir-mg-interp2.c @@ -1,18 +1,18 @@ -{ - for (int c1 = 1; c1 <= O - 1; c1 += 1) - for (int c3 = Q; c3 <= N - 1; c3 += 1) - for (int c5 = P; c5 <= M - 1; c5 += 1) - S1(c1, c3, c5); - for (int c1 = 1; c1 <= O - 1; c1 += 1) - for (int c3 = Q; c3 <= N - 1; c3 += 1) - for (int c5 = 1; c5 <= M - 1; c5 += 1) - S2(c1, c3, c5); - for (int c1 = 1; c1 <= O - 1; c1 += 1) - for (int c3 = 1; c3 <= N - 1; c3 += 1) - for (int c5 = P; c5 <= M - 1; c5 += 1) - S3(c1, c3, c5); - for (int c1 = 1; c1 <= O - 1; c1 += 1) - for (int c3 = 1; c3 <= N - 1; c3 += 1) - for (int c5 = 1; c5 <= M - 1; c5 += 1) - S4(c1, c3, c5); -} +{ + for (int c1 = 1; c1 < O; c1 += 1) + for (int c3 = Q; c3 < N; c3 += 1) + for (int c5 = P; c5 < M; c5 += 1) + S1(c1, c3, c5); + for (int c1 = 1; c1 < O; c1 += 1) + for (int c3 = Q; c3 < N; c3 += 1) + for (int c5 = 1; c5 < M; c5 += 1) + S2(c1, c3, c5); + for (int c1 = 1; c1 < O; c1 += 1) + for (int c3 = 1; c3 < N; c3 += 1) + for (int c5 = P; c5 < M; c5 += 1) + S3(c1, c3, c5); + for (int c1 = 1; c1 < O; c1 += 1) + for (int c3 = 1; c3 < N; c3 += 1) + for (int c5 = 1; c5 < M; c5 += 1) + S4(c1, c3, c5); +} diff --git a/test_inputs/codegen/cloog/reservoir-mg-psinv.c b/test_inputs/codegen/cloog/reservoir-mg-psinv.c index a7b3e87c..e3a5deeb 100644 --- a/test_inputs/codegen/cloog/reservoir-mg-psinv.c +++ b/test_inputs/codegen/cloog/reservoir-mg-psinv.c @@ -1,9 +1,9 @@ -for (int c1 = 2; c1 <= O - 1; c1 += 1) - for (int c3 = 3; c3 <= 2 * N - 3; c3 += 2) { +for (int c1 = 2; c1 < O; c1 += 1) + for (int c3 = 3; c3 < 2 * N - 2; c3 += 2) { for (int c5 = 1; c5 <= M; c5 += 1) { S1(c1, (c3 + 1) / 2, c5); S2(c1, (c3 + 1) / 2, c5); } - for (int c5 = 2; c5 <= M - 1; c5 += 1) + for (int c5 = 2; c5 < M; c5 += 1) S3(c1, (c3 + 1) / 2, c5); } diff --git a/test_inputs/codegen/cloog/reservoir-mg-resid.c b/test_inputs/codegen/cloog/reservoir-mg-resid.c index a7b3e87c..e3a5deeb 100644 --- a/test_inputs/codegen/cloog/reservoir-mg-resid.c +++ b/test_inputs/codegen/cloog/reservoir-mg-resid.c @@ -1,9 +1,9 @@ -for (int c1 = 2; c1 <= O - 1; c1 += 1) - for (int c3 = 3; c3 <= 2 * N - 3; c3 += 2) { +for (int c1 = 2; c1 < O; c1 += 1) + for (int c3 = 3; c3 < 2 * N - 2; c3 += 2) { for (int c5 = 1; c5 <= M; c5 += 1) { S1(c1, (c3 + 1) / 2, c5); S2(c1, (c3 + 1) / 2, c5); } - for (int c5 = 2; c5 <= M - 1; c5 += 1) + for (int c5 = 2; c5 < M; c5 += 1) S3(c1, (c3 + 1) / 2, c5); } diff --git a/test_inputs/codegen/cloog/reservoir-mg-rprj3.c b/test_inputs/codegen/cloog/reservoir-mg-rprj3.c index 3e25bdce..fcd00251 100644 --- a/test_inputs/codegen/cloog/reservoir-mg-rprj3.c +++ b/test_inputs/codegen/cloog/reservoir-mg-rprj3.c @@ -1,13 +1,13 @@ if (N >= 3 && M >= 2) - for (int c1 = 2; c1 <= O - 1; c1 += 1) { + for (int c1 = 2; c1 < O; c1 += 1) { for (int c5 = 2; c5 <= M; c5 += 1) S1(c1, 2, c5); - for (int c3 = 3; c3 <= N - 1; c3 += 1) { + for (int c3 = 3; c3 < N; c3 += 1) { for (int c5 = 2; c5 <= M; c5 += 1) S2(c1, c3 - 1, c5); if (M >= 3) { S4(c1, c3 - 1, 2); - for (int c5 = 2; c5 <= M - 2; c5 += 1) { + for (int c5 = 2; c5 < M - 1; c5 += 1) { S3(c1, c3 - 1, c5); S5(c1, c3 - 1, c5); S4(c1, c3 - 1, c5 + 1); @@ -22,7 +22,7 @@ if (N >= 3 && M >= 2) S2(c1, N - 1, c5); if (M >= 3) { S4(c1, N - 1, 2); - for (int c5 = 2; c5 <= M - 2; c5 += 1) { + for (int c5 = 2; c5 < M - 1; c5 += 1) { S3(c1, N - 1, c5); S5(c1, N - 1, c5); S4(c1, N - 1, c5 + 1); diff --git a/test_inputs/codegen/cloog/reservoir-pingali1.c b/test_inputs/codegen/cloog/reservoir-pingali1.c index cff4b8e6..7268c23d 100644 --- a/test_inputs/codegen/cloog/reservoir-pingali1.c +++ b/test_inputs/codegen/cloog/reservoir-pingali1.c @@ -1,6 +1,6 @@ for (int c1 = 1; c1 <= M; c1 += 1) - for (int c3 = 1; c3 <= 2 * N - 1; c3 += 1) { - for (int c5 = max(1, -N + c3); c5 <= (c3 + 1) / 2 - 1; c5 += 1) + for (int c3 = 1; c3 < 2 * N; c3 += 1) { + for (int c5 = max(1, -N + c3); c5 < (c3 + 1) / 2; c5 += 1) S1(c1, c3 - c5, c5); if ((c3 - 1) % 2 == 0) S2(c1, (c3 + 1) / 2); diff --git a/test_inputs/codegen/cloog/reservoir-pingali5.c b/test_inputs/codegen/cloog/reservoir-pingali5.c index 1d337c09..fe2d283c 100644 --- a/test_inputs/codegen/cloog/reservoir-pingali5.c +++ b/test_inputs/codegen/cloog/reservoir-pingali5.c @@ -1,10 +1,10 @@ -for (int c1 = 3; c1 <= 2 * M - 1; c1 += 1) { +for (int c1 = 3; c1 < 2 * M; c1 += 1) { for (int c3 = c1 - (c1 + 1) / 2 + 2; c3 <= M; c3 += 1) - for (int c7 = c1 - (c1 + 1) / 2 + 1; c7 <= min(c1 - 1, c3 - 1); c7 += 1) + for (int c7 = c1 - (c1 + 1) / 2 + 1; c7 < min(c1, c3); c7 += 1) S1(c7, c1 - c7, c3); - for (int c3 = max(1, -M + c1); c3 <= (c1 + 1) / 2 - 1; c3 += 1) + for (int c3 = max(1, -M + c1); c3 < (c1 + 1) / 2; c3 += 1) S2(c1 - c3, c3); for (int c3 = c1 - (c1 + 1) / 2 + 2; c3 <= M; c3 += 1) - for (int c7 = c1 - (c1 + 1) / 2 + 1; c7 <= min(c1 - 1, c3 - 1); c7 += 1) + for (int c7 = c1 - (c1 + 1) / 2 + 1; c7 < min(c1, c3); c7 += 1) S3(c7, c1 - c7, c3); } diff --git a/test_inputs/codegen/cloog/reservoir-pingali6.c b/test_inputs/codegen/cloog/reservoir-pingali6.c index 011b912c..1df9bb90 100644 --- a/test_inputs/codegen/cloog/reservoir-pingali6.c +++ b/test_inputs/codegen/cloog/reservoir-pingali6.c @@ -1,8 +1,8 @@ for (int c1 = 1; c1 <= M; c1 += 1) { - for (int c3 = 2; c3 <= N - 1; c3 += 1) - for (int c5 = 2; c5 <= N - 1; c5 += 1) + for (int c3 = 2; c3 < N; c3 += 1) + for (int c5 = 2; c5 < N; c5 += 1) S1(c1, c3, c5); - for (int c3 = 2; c3 <= N - 1; c3 += 1) - for (int c5 = 2; c5 <= N - 1; c5 += 1) + for (int c3 = 2; c3 < N; c3 += 1) + for (int c5 = 2; c5 < N; c5 += 1) S2(c1, c3, c5); } diff --git a/test_inputs/codegen/cloog/thomasset.c b/test_inputs/codegen/cloog/thomasset.c index c5ad4cef..c711dc2e 100644 --- a/test_inputs/codegen/cloog/thomasset.c +++ b/test_inputs/codegen/cloog/thomasset.c @@ -3,7 +3,7 @@ for (int c2 = 3 * c0 + 1; c2 <= min(n, 3 * c0 + 3); c2 += 1) S1(c2, c0); for (int c0 = floord(n, 3); c0 <= floord(n, 3) + floord(n, 3); c0 += 1) - for (int c1 = 0; c1 <= n - 1; c1 += 1) + for (int c1 = 0; c1 < n; c1 += 1) for (int c3 = max(-n + 3 * c0, 1); c3 <= min(-n + 3 * c0 + 4, n); c3 += 1) if (((3 * c0 - c3 + 2) % 3) + n + c3 >= 3 * c0 + 2 && 3 * c0 + 4 >= ((3 * c0 - c3 + 2) % 3) + n + c3) S2(c1 + 1, c3, 0, n / 3, c0 - n / 3); diff --git a/test_inputs/codegen/cloog/usvd_e_t.c b/test_inputs/codegen/cloog/usvd_e_t.c index feb07eda..af8c9fe4 100644 --- a/test_inputs/codegen/cloog/usvd_e_t.c +++ b/test_inputs/codegen/cloog/usvd_e_t.c @@ -20,22 +20,22 @@ for (int c1 = 7; c1 <= 11; c1 += 1) S8(4, c1, 0); for (int c0 = 5; c0 <= 6; c0 += 1) { - for (int c1 = -4; c1 <= c0 - 9; c1 += 1) + for (int c1 = -4; c1 < c0 - 8; c1 += 1) S6(c0, c1, 0); - for (int c1 = c0 - 9; c1 <= -1; c1 += 1) + for (int c1 = c0 - 9; c1 < 0; c1 += 1) S7(c0, c1, 0); S3(c0, 0, 0); S7(c0, 0, 0); - for (int c1 = 1; c1 <= c0 - 4; c1 += 1) + for (int c1 = 1; c1 < c0 - 3; c1 += 1) S4(c0, c1, -1); for (int c1 = c0 - 4; c1 <= 4; c1 += 1) S5(c0, c1, 0); for (int c1 = 7; c1 <= 11; c1 += 1) S8(c0, c1, 0); } - for (int c1 = -4; c1 <= -2; c1 += 1) + for (int c1 = -4; c1 < -1; c1 += 1) S6(7, c1, 0); - for (int c1 = -2; c1 <= -1; c1 += 1) + for (int c1 = -2; c1 < 0; c1 += 1) S7(7, c1, 0); S3(7, 0, 0); S7(7, 0, 0); @@ -75,7 +75,7 @@ S22(7, 9, 0); for (int c1 = 10; c1 <= 11; c1 += 1) S8(7, c1, 0); - for (int c1 = -4; c1 <= -1; c1 += 1) + for (int c1 = -4; c1 < 0; c1 += 1) S6(8, c1, 0); S7(8, -1, 0); S3(8, 0, 0); @@ -86,7 +86,7 @@ S19(8, 1, 0); S15(8, 1, 4); S18(8, 1, 4); - for (int c2 = -4; c2 <= -3; c2 += 1) { + for (int c2 = -4; c2 < -2; c2 += 1) { S14(8, 2, c2); S20(8, 2, c2); } @@ -102,7 +102,7 @@ S20(8, 2, 0); S15(8, 2, 4); S18(8, 2, 4); - for (int c2 = -4; c2 <= -2; c2 += 1) { + for (int c2 = -4; c2 < -1; c2 += 1) { S14(8, 3, c2); S20(8, 3, c2); } @@ -113,7 +113,7 @@ S20(8, 3, 0); S15(8, 3, 4); S18(8, 3, 4); - for (int c2 = -4; c2 <= -2; c2 += 1) { + for (int c2 = -4; c2 < -1; c2 += 1) { S14(8, 4, c2); S20(8, 4, c2); } @@ -184,7 +184,7 @@ } } S20(9, 3, -4); - for (int c2 = -3; c2 <= -2; c2 += 1) { + for (int c2 = -3; c2 < -1; c2 += 1) { S14(9, 3, c2); S20(9, 3, c2); } @@ -198,7 +198,7 @@ S18(9, 3, c2); } S20(9, 4, -4); - for (int c2 = -3; c2 <= -1; c2 += 1) { + for (int c2 = -3; c2 < 0; c2 += 1) { S14(9, 4, c2); S20(9, 4, c2); } @@ -278,9 +278,9 @@ S18(10, c1, c2); } } - for (int c2 = -4; c2 <= -3; c2 += 1) + for (int c2 = -4; c2 < -2; c2 += 1) S20(10, 4, c2); - for (int c2 = -2; c2 <= -1; c2 += 1) { + for (int c2 = -2; c2 < 0; c2 += 1) { S14(10, 4, c2); S20(10, 4, c2); } diff --git a/test_inputs/codegen/cloog/vasilache.c b/test_inputs/codegen/cloog/vasilache.c index 974dc04e..567e41f4 100644 --- a/test_inputs/codegen/cloog/vasilache.c +++ b/test_inputs/codegen/cloog/vasilache.c @@ -1,13 +1,13 @@ { S1(); S2(); - for (int c1 = 0; c1 <= N - 1; c1 += 1) - for (int c3 = 0; c3 <= N - 1; c3 += 1) { + for (int c1 = 0; c1 < N; c1 += 1) + for (int c3 = 0; c3 < N; c3 += 1) { S4(c1, c3); S5(c1, c3); } - for (int c1 = 0; c1 <= N - 1; c1 += 1) - for (int c3 = 0; c3 <= N - 1; c3 += 1) + for (int c1 = 0; c1 < N; c1 += 1) + for (int c3 = 0; c3 < N; c3 += 1) for (int c5 = 0; c5 <= (N - 1) / 32; c5 += 1) { S7(c1, c3, c5, 32 * c5); for (int c7 = 32 * c5 + 1; c7 <= min(N - 1, 32 * c5 + 31); c7 += 1) { diff --git a/test_inputs/codegen/cloog/vivien.c b/test_inputs/codegen/cloog/vivien.c index 025d8700..70e2fb77 100644 --- a/test_inputs/codegen/cloog/vivien.c +++ b/test_inputs/codegen/cloog/vivien.c @@ -5,11 +5,11 @@ if (2 * n >= c0 + 1 && c0 >= 3) S4(c0 - c0 / 2 - 1, c0 / 2 + 1); if (2 * n >= c0 + 1 && c0 + 2 >= 2 * n) { - for (int c2 = 1; c2 <= -n + c0 - 1; c2 += 1) + for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } else if (2 * n >= c0 + 3 && c0 >= 5) { S4(c0 - c0 / 2 - 2, c0 / 2 + 2); - for (int c2 = 1; c2 <= (c0 + 1) / 2 - 2; c2 += 1) + for (int c2 = 1; c2 < (c0 + 1) / 2 - 1; c2 += 1) S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -((c0 + 1) / 2) + 3; c1 <= min(n - c0, -1); c1 += 1) { @@ -20,7 +20,7 @@ } if (c0 >= n + 2 && 2 * n >= c0 + 3) { S6(-n + c0 + 1, n - 1); - for (int c2 = 1; c2 <= -n + c0 - 1; c2 += 1) + for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } if (2 * n >= c0 + 1 && c0 >= n + 3) @@ -45,7 +45,7 @@ S1(3); if (c0 % 2 == 0) S3(c0 / 2); - for (int c1 = max(-n + c0, 1); c1 <= (c0 + 1) / 2 - 1; c1 += 1) + for (int c1 = max(-n + c0, 1); c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } for (int c0 = max(-27 * n + 2, 2 * n + 1); c0 <= n + 29; c0 += 1) @@ -54,11 +54,11 @@ if (2 * n >= c0 + 1) { S4(c0 - c0 / 2 - 1, c0 / 2 + 1); if (c0 + 2 >= 2 * n) { - for (int c2 = 1; c2 <= -n + c0 - 1; c2 += 1) + for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } else { S4(c0 - c0 / 2 - 2, c0 / 2 + 2); - for (int c2 = 1; c2 <= (c0 + 1) / 2 - 2; c2 += 1) + for (int c2 = 1; c2 < (c0 + 1) / 2 - 1; c2 += 1) S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -((c0 + 1) / 2) + 3; c1 <= n - c0; c1 += 1) { @@ -69,14 +69,14 @@ } if (2 * n >= c0 + 3) { S6(-n + c0 + 1, n - 1); - for (int c2 = 1; c2 <= -n + c0 - 1; c2 += 1) + for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } S6(-n + c0, n); } if (c0 % 2 == 0) S3(c0 / 2); - for (int c1 = -n + c0; c1 <= (c0 + 1) / 2 - 1; c1 += 1) + for (int c1 = -n + c0; c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } } diff --git a/test_inputs/codegen/cloog/vivien2.c b/test_inputs/codegen/cloog/vivien2.c index a36ef352..4cb18640 100644 --- a/test_inputs/codegen/cloog/vivien2.c +++ b/test_inputs/codegen/cloog/vivien2.c @@ -5,11 +5,11 @@ if (c0 >= 3) { S4(c0 - c0 / 2 - 1, c0 / 2 + 1); if (c0 + 2 >= 2 * n) { - for (int c2 = 1; c2 <= -n + c0 - 1; c2 += 1) + for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } else if (c0 >= 5) { S4(c0 - c0 / 2 - 2, c0 / 2 + 2); - for (int c2 = 1; c2 <= (c0 + 1) / 2 - 2; c2 += 1) + for (int c2 = 1; c2 < (c0 + 1) / 2 - 1; c2 += 1) S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } } @@ -21,7 +21,7 @@ } if (2 * n >= c0 + 3 && c0 >= n + 2) { S6(-n + c0 + 1, n - 1); - for (int c2 = 1; c2 <= -n + c0 - 1; c2 += 1) + for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } if (c0 >= n + 3) { @@ -43,18 +43,18 @@ S1(1); if (c0 % 2 == 0) S3(c0 / 2); - for (int c1 = max(-n + c0, 1); c1 <= (c0 + 1) / 2 - 1; c1 += 1) + for (int c1 = max(-n + c0, 1); c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } for (int c0 = n + 30; c0 <= 2 * n; c0 += 1) { if (2 * n >= c0 + 1) { S4(c0 - c0 / 2 - 1, c0 / 2 + 1); if (c0 + 2 >= 2 * n) { - for (int c2 = 1; c2 <= -n + c0 - 1; c2 += 1) + for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } else { S4(c0 - c0 / 2 - 2, c0 / 2 + 2); - for (int c2 = 1; c2 <= (c0 + 1) / 2 - 2; c2 += 1) + for (int c2 = 1; c2 < (c0 + 1) / 2 - 1; c2 += 1) S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -((c0 + 1) / 2) + 3; c1 <= n - c0; c1 += 1) { @@ -65,14 +65,14 @@ } if (2 * n >= c0 + 3) { S6(-n + c0 + 1, n - 1); - for (int c2 = 1; c2 <= -n + c0 - 1; c2 += 1) + for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } S6(-n + c0, n); } if (c0 % 2 == 0) S3(c0 / 2); - for (int c1 = -n + c0; c1 <= (c0 + 1) / 2 - 1; c1 += 1) + for (int c1 = -n + c0; c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } } diff --git a/test_inputs/codegen/cloog/yosr.c b/test_inputs/codegen/cloog/yosr.c index 0f465aef..1c20057b 100644 --- a/test_inputs/codegen/cloog/yosr.c +++ b/test_inputs/codegen/cloog/yosr.c @@ -1,12 +1,12 @@ { - for (int c0 = 1; c0 <= n - 1; c0 += 1) { + for (int c0 = 1; c0 < n; c0 += 1) { for (int c2 = c0 + 1; c2 <= n; c2 += 1) S1(c0, c2); - for (int c1 = 1; c1 <= c0 - 1; c1 += 1) + for (int c1 = 1; c1 < c0; c1 += 1) for (int c2 = c1 + 1; c2 <= n; c2 += 1) S2(c1, c2, c0); } - for (int c1 = 1; c1 <= n - 1; c1 += 1) + for (int c1 = 1; c1 < n; c1 += 1) for (int c2 = c1 + 1; c2 <= n; c2 += 1) S2(c1, c2, n); } diff --git a/test_inputs/codegen/cloog/yosr2.c b/test_inputs/codegen/cloog/yosr2.c index 91d8f3e3..a4c0cd29 100644 --- a/test_inputs/codegen/cloog/yosr2.c +++ b/test_inputs/codegen/cloog/yosr2.c @@ -2,12 +2,12 @@ for (int c1 = 1; c1 <= M; c1 += 1) S2(c1); for (int c0 = 2; c0 <= M; c0 += 1) { - for (int c2 = 1; c2 <= c0 - 1; c2 += 1) + for (int c2 = 1; c2 < c0; c2 += 1) S1(c0, c2); for (int c2 = c0 + 1; c2 <= M; c2 += 1) - for (int c3 = 1; c3 <= c0 - 1; c3 += 1) + for (int c3 = 1; c3 < c0; c3 += 1) S3(c0, c2, c3); - for (int c1 = 1; c1 <= c0 - 1; c1 += 1) + for (int c1 = 1; c1 < c0; c1 += 1) S4(c1, c0); } } diff --git a/test_inputs/codegen/omega/chosol-0.c b/test_inputs/codegen/omega/chosol-0.c index f2f244e1..464ee493 100644 --- a/test_inputs/codegen/omega/chosol-0.c +++ b/test_inputs/codegen/omega/chosol-0.c @@ -1,7 +1,7 @@ { for (int c1 = 2; c1 <= n; c1 += 1) s0(c1); - for (int c1 = 1; c1 <= n - 1; c1 += 1) { + for (int c1 = 1; c1 < n; c1 += 1) { for (int c3 = c1 + 1; c3 <= n; c3 += 1) s1(c3, c1); s2(c1 + 1); diff --git a/test_inputs/codegen/omega/chosol-1.c b/test_inputs/codegen/omega/chosol-1.c index f2f244e1..464ee493 100644 --- a/test_inputs/codegen/omega/chosol-1.c +++ b/test_inputs/codegen/omega/chosol-1.c @@ -1,7 +1,7 @@ { for (int c1 = 2; c1 <= n; c1 += 1) s0(c1); - for (int c1 = 1; c1 <= n - 1; c1 += 1) { + for (int c1 = 1; c1 < n; c1 += 1) { for (int c3 = c1 + 1; c3 <= n; c3 += 1) s1(c3, c1); s2(c1 + 1); diff --git a/test_inputs/codegen/omega/code_gen-1.c b/test_inputs/codegen/omega/code_gen-1.c index 80131bb5..edac4961 100644 --- a/test_inputs/codegen/omega/code_gen-1.c +++ b/test_inputs/codegen/omega/code_gen-1.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= 8; c0 += 1) { if (c0 <= 6) - for (int c1 = 0; c1 <= c0 - 2; c1 += 1) + for (int c1 = 0; c1 < c0 - 1; c1 += 1) s1(c0, c1); if (c0 >= 2) { for (int c1 = c0 - 1; c1 <= 4; c1 += 1) { diff --git a/test_inputs/codegen/omega/code_gen-2.c b/test_inputs/codegen/omega/code_gen-2.c index e96c7c6b..f92e5836 100644 --- a/test_inputs/codegen/omega/code_gen-2.c +++ b/test_inputs/codegen/omega/code_gen-2.c @@ -2,7 +2,7 @@ for (int c1 = 0; c1 <= 7; c1 += 1) s0(1, c1); for (int c0 = 2; c0 <= 6; c0 += 1) { - for (int c1 = 0; c1 <= c0 - 2; c1 += 1) + for (int c1 = 0; c1 < c0 - 1; c1 += 1) s1(c0, c1); for (int c1 = c0 - 1; c1 <= 4; c1 += 1) { s1(c0, c1); diff --git a/test_inputs/codegen/omega/collard-0.c b/test_inputs/codegen/omega/collard-0.c index 0664228f..413fbda4 100644 --- a/test_inputs/codegen/omega/collard-0.c +++ b/test_inputs/codegen/omega/collard-0.c @@ -1,10 +1,10 @@ { for (int c4 = 1; c4 <= n; c4 += 1) s2(c4); - for (int c1 = 1; c1 <= n - 1; c1 += 1) { - for (int c4 = 0; c4 <= n - c1 - 1; c4 += 1) + for (int c1 = 1; c1 < n; c1 += 1) { + for (int c4 = 0; c4 < n - c1; c4 += 1) s0(c1, n - c4); - for (int c3 = 0; c3 <= n - c1 - 1; c3 += 1) + for (int c3 = 0; c3 < n - c1; c3 += 1) for (int c4 = c1 + 1; c4 <= n; c4 += 1) s1(c1, n - c3, c4); } diff --git a/test_inputs/codegen/omega/fc1-0.c b/test_inputs/codegen/omega/fc1-0.c index 9fd24090..fbec13a7 100644 --- a/test_inputs/codegen/omega/fc1-0.c +++ b/test_inputs/codegen/omega/fc1-0.c @@ -1,7 +1,7 @@ -for (int c0 = 0; c0 <= n - 2; c0 += 1) { - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) +for (int c0 = 0; c0 < n - 1; c0 += 1) { + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) s0(c0 + 1, n - c3); - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) for (int c6 = c0 + 2; c6 <= n; c6 += 1) s1(c0 + 1, n - c3, c6); } diff --git a/test_inputs/codegen/omega/fc1-1.c b/test_inputs/codegen/omega/fc1-1.c index 6ee68b42..768a04fb 100644 --- a/test_inputs/codegen/omega/fc1-1.c +++ b/test_inputs/codegen/omega/fc1-1.c @@ -1,14 +1,14 @@ { for (int c3 = 1; c3 <= n; c3 += 1) s2(c3); - for (int c0 = 0; c0 <= n - 2; c0 += 1) { - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) + for (int c0 = 0; c0 < n - 1; c0 += 1) { + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) s0(c0 + 1, n - c3); - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) for (int c6 = c0 + 2; c6 <= n; c6 += 1) s1(c0 + 1, n - c3, c6); } - for (int c0 = n - 1; c0 <= 2 * n - 2; c0 += 1) { + for (int c0 = n - 1; c0 < 2 * n - 1; c0 += 1) { if (c0 >= n) for (int c2 = -n + c0 + 2; c2 <= n; c2 += 1) s3(c2, -n + c0 + 1); diff --git a/test_inputs/codegen/omega/fc1-2.c b/test_inputs/codegen/omega/fc1-2.c index 6ee68b42..768a04fb 100644 --- a/test_inputs/codegen/omega/fc1-2.c +++ b/test_inputs/codegen/omega/fc1-2.c @@ -1,14 +1,14 @@ { for (int c3 = 1; c3 <= n; c3 += 1) s2(c3); - for (int c0 = 0; c0 <= n - 2; c0 += 1) { - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) + for (int c0 = 0; c0 < n - 1; c0 += 1) { + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) s0(c0 + 1, n - c3); - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) for (int c6 = c0 + 2; c6 <= n; c6 += 1) s1(c0 + 1, n - c3, c6); } - for (int c0 = n - 1; c0 <= 2 * n - 2; c0 += 1) { + for (int c0 = n - 1; c0 < 2 * n - 1; c0 += 1) { if (c0 >= n) for (int c2 = -n + c0 + 2; c2 <= n; c2 += 1) s3(c2, -n + c0 + 1); diff --git a/test_inputs/codegen/omega/fc2-0.c b/test_inputs/codegen/omega/fc2-0.c index 9fd24090..fbec13a7 100644 --- a/test_inputs/codegen/omega/fc2-0.c +++ b/test_inputs/codegen/omega/fc2-0.c @@ -1,7 +1,7 @@ -for (int c0 = 0; c0 <= n - 2; c0 += 1) { - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) +for (int c0 = 0; c0 < n - 1; c0 += 1) { + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) s0(c0 + 1, n - c3); - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) for (int c6 = c0 + 2; c6 <= n; c6 += 1) s1(c0 + 1, n - c3, c6); } diff --git a/test_inputs/codegen/omega/fc2-1.c b/test_inputs/codegen/omega/fc2-1.c index 6ee68b42..768a04fb 100644 --- a/test_inputs/codegen/omega/fc2-1.c +++ b/test_inputs/codegen/omega/fc2-1.c @@ -1,14 +1,14 @@ { for (int c3 = 1; c3 <= n; c3 += 1) s2(c3); - for (int c0 = 0; c0 <= n - 2; c0 += 1) { - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) + for (int c0 = 0; c0 < n - 1; c0 += 1) { + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) s0(c0 + 1, n - c3); - for (int c3 = 0; c3 <= n - c0 - 2; c3 += 1) + for (int c3 = 0; c3 < n - c0 - 1; c3 += 1) for (int c6 = c0 + 2; c6 <= n; c6 += 1) s1(c0 + 1, n - c3, c6); } - for (int c0 = n - 1; c0 <= 2 * n - 2; c0 += 1) { + for (int c0 = n - 1; c0 < 2 * n - 1; c0 += 1) { if (c0 >= n) for (int c2 = -n + c0 + 2; c2 <= n; c2 += 1) s3(c2, -n + c0 + 1); diff --git a/test_inputs/codegen/omega/ge-0.c b/test_inputs/codegen/omega/ge-0.c index 4e57c574..1c22a5d9 100644 --- a/test_inputs/codegen/omega/ge-0.c +++ b/test_inputs/codegen/omega/ge-0.c @@ -1,6 +1,6 @@ for (int c0 = 2; c0 <= n; c0 += 1) for (int c1 = 1; c1 <= n; c1 += 1) { - for (int c3 = 1; c3 <= min(c0 - 1, c1 - 1); c3 += 1) + for (int c3 = 1; c3 < min(c0, c1); c3 += 1) s1(c3, c0, c1); if (c0 >= c1 + 1) s0(c1, c0); diff --git a/test_inputs/codegen/omega/ge-1.c b/test_inputs/codegen/omega/ge-1.c index 4e57c574..1c22a5d9 100644 --- a/test_inputs/codegen/omega/ge-1.c +++ b/test_inputs/codegen/omega/ge-1.c @@ -1,6 +1,6 @@ for (int c0 = 2; c0 <= n; c0 += 1) for (int c1 = 1; c1 <= n; c1 += 1) { - for (int c3 = 1; c3 <= min(c0 - 1, c1 - 1); c3 += 1) + for (int c3 = 1; c3 < min(c0, c1); c3 += 1) s1(c3, c0, c1); if (c0 >= c1 + 1) s0(c1, c0); diff --git a/test_inputs/codegen/omega/gist-3.c b/test_inputs/codegen/omega/gist-3.c index 07ba418c..513f385c 100644 --- a/test_inputs/codegen/omega/gist-3.c +++ b/test_inputs/codegen/omega/gist-3.c @@ -1,3 +1,3 @@ -for (int c0 = 1; c0 <= n - 1; c0 += 4) +for (int c0 = 1; c0 < n; c0 += 4) for (int c1 = c0 + 1; c1 <= n; c1 += 6) s0(c0, c1); diff --git a/test_inputs/codegen/omega/lu-0.c b/test_inputs/codegen/omega/lu-0.c index 9efe2089..abb9eae3 100644 --- a/test_inputs/codegen/omega/lu-0.c +++ b/test_inputs/codegen/omega/lu-0.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= n - 1; c0 += 64) +for (int c0 = 1; c0 < n; c0 += 64) for (int c1 = c0 - 1; c1 <= n; c1 += 64) for (int c2 = c0; c2 <= n; c2 += 1) { for (int c3 = c0; c3 <= min(min(c2 - 1, c0 + 63), c1 + 62); c3 += 1) diff --git a/test_inputs/codegen/omega/lu-1.c b/test_inputs/codegen/omega/lu-1.c index 9efe2089..abb9eae3 100644 --- a/test_inputs/codegen/omega/lu-1.c +++ b/test_inputs/codegen/omega/lu-1.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= n - 1; c0 += 64) +for (int c0 = 1; c0 < n; c0 += 64) for (int c1 = c0 - 1; c1 <= n; c1 += 64) for (int c2 = c0; c2 <= n; c2 += 1) { for (int c3 = c0; c3 <= min(min(c2 - 1, c0 + 63), c1 + 62); c3 += 1) diff --git a/test_inputs/codegen/omega/lu-2.c b/test_inputs/codegen/omega/lu-2.c index 9efe2089..abb9eae3 100644 --- a/test_inputs/codegen/omega/lu-2.c +++ b/test_inputs/codegen/omega/lu-2.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= n - 1; c0 += 64) +for (int c0 = 1; c0 < n; c0 += 64) for (int c1 = c0 - 1; c1 <= n; c1 += 64) for (int c2 = c0; c2 <= n; c2 += 1) { for (int c3 = c0; c3 <= min(min(c2 - 1, c0 + 63), c1 + 62); c3 += 1) diff --git a/test_inputs/codegen/omega/lu-3.c b/test_inputs/codegen/omega/lu-3.c index 36affb06..4be6c2be 100644 --- a/test_inputs/codegen/omega/lu-3.c +++ b/test_inputs/codegen/omega/lu-3.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= n - 1; c0 += 64) +for (int c0 = 1; c0 < n; c0 += 64) for (int c1 = c0 - 1; c1 <= n; c1 += 64) { for (int c2 = c0; c2 <= min(c0 + 63, n); c2 += 1) { for (int c3 = c0; c3 <= min(c1 + 62, c2 - 1); c3 += 1) diff --git a/test_inputs/codegen/omega/lu_ijk-0.c b/test_inputs/codegen/omega/lu_ijk-0.c index 4c6ffc5d..da2571ac 100644 --- a/test_inputs/codegen/omega/lu_ijk-0.c +++ b/test_inputs/codegen/omega/lu_ijk-0.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= n; c0 += 1) for (int c1 = 2; c1 <= n; c1 += 1) { - for (int c3 = 1; c3 <= min(c0 - 1, c1 - 1); c3 += 1) + for (int c3 = 1; c3 < min(c0, c1); c3 += 1) s1(c3, c1, c0); if (c1 >= c0 + 1) s0(c0, c1); diff --git a/test_inputs/codegen/omega/lu_ijk-1.c b/test_inputs/codegen/omega/lu_ijk-1.c index 4c6ffc5d..da2571ac 100644 --- a/test_inputs/codegen/omega/lu_ijk-1.c +++ b/test_inputs/codegen/omega/lu_ijk-1.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= n; c0 += 1) for (int c1 = 2; c1 <= n; c1 += 1) { - for (int c3 = 1; c3 <= min(c0 - 1, c1 - 1); c3 += 1) + for (int c3 = 1; c3 < min(c0, c1); c3 += 1) s1(c3, c1, c0); if (c1 >= c0 + 1) s0(c0, c1); diff --git a/test_inputs/codegen/omega/lu_ijk-2.c b/test_inputs/codegen/omega/lu_ijk-2.c index b7e36008..561ae110 100644 --- a/test_inputs/codegen/omega/lu_ijk-2.c +++ b/test_inputs/codegen/omega/lu_ijk-2.c @@ -1,10 +1,10 @@ if (n >= 2) for (int c0 = 1; c0 <= n; c0 += 1) { for (int c1 = 2; c1 <= c0; c1 += 1) - for (int c3 = 1; c3 <= c1 - 1; c3 += 1) + for (int c3 = 1; c3 < c1; c3 += 1) s1(c3, c1, c0); for (int c1 = c0 + 1; c1 <= n; c1 += 1) { - for (int c3 = 1; c3 <= c0 - 1; c3 += 1) + for (int c3 = 1; c3 < c0; c3 += 1) s1(c3, c1, c0); s0(c0, c1); } diff --git a/test_inputs/codegen/omega/olda-1.c b/test_inputs/codegen/omega/olda-1.c index ab642fab..4b309806 100644 --- a/test_inputs/codegen/omega/olda-1.c +++ b/test_inputs/codegen/omega/olda-1.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= morb; c0 += 1) for (int c1 = 1; c1 <= np; c1 += 1) { - for (int c2 = 1; c2 <= c1 - 1; c2 += 1) + for (int c2 = 1; c2 < c1; c2 += 1) s1(c1, c2, c0); s0(c1, c1, c0); s1(c1, c1, c0); diff --git a/test_inputs/codegen/omega/ts1d-check-sblock-0.c b/test_inputs/codegen/omega/ts1d-check-sblock-0.c index ca13e21b..46adf237 100644 --- a/test_inputs/codegen/omega/ts1d-check-sblock-0.c +++ b/test_inputs/codegen/omega/ts1d-check-sblock-0.c @@ -4,7 +4,7 @@ s0(1, 1, 1, 0, 0); s0(1, 1, 1, N - 1, 0); } else - for (int c3 = 0; c3 <= N - 1; c3 += 1) + for (int c3 = 0; c3 < N; c3 += 1) s0(1, 0, 1, c3, 0); for (int c1 = 0; c1 <= floord(T - 1, 1000); c1 += 1) for (int c2 = 1000 * c1 + 1; c2 <= min(N + 1000 * c1 + 997, N + T - 3); c2 += 1) diff --git a/test_inputs/codegen/omega/ts1d-check0-0.c b/test_inputs/codegen/omega/ts1d-check0-0.c index cb854dfd..e00eb91b 100644 --- a/test_inputs/codegen/omega/ts1d-check0-0.c +++ b/test_inputs/codegen/omega/ts1d-check0-0.c @@ -1,5 +1,5 @@ { - for (int c1 = 0; c1 <= N - 1; c1 += 1) + for (int c1 = 0; c1 < N; c1 += 1) s0(1, c1, 1, 0, 0); for (int c1 = 0; c1 <= floord(T - 1, 500); c1 += 1) for (int c2 = 1000 * c1; c2 <= min(N + 1000 * c1 + 997, N + 2 * T - 3); c2 += 1) { diff --git a/test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c b/test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c index f7ed3698..1ab5459b 100644 --- a/test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c +++ b/test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c @@ -1,6 +1,6 @@ { - for (int c1 = -1; c1 <= (T >= 1 ? T - 1 : -1); c1 += 1) - for (int c2 = 0; c2 <= N - 1; c2 += 1) + for (int c1 = -1; c1 < (T >= 1 ? T : 0); c1 += 1) + for (int c2 = 0; c2 < N; c2 += 1) if (c2 == 0 && c1 >= 0 && T >= c1 + 1) { s0(1, c1, 0, 0, 0); } else if (c2 + 1 == N && T >= c1 + 1 && c1 >= 0) { @@ -29,6 +29,6 @@ } if (T >= 1) for (int c3 = -floord(T - 2, 4000); c3 <= floord(N - T - 2, 4000) + 1; c3 += 1) - for (int c4 = max(2 * T + 4000 * c3 - 4001, T); c4 <= min(2 * T + 4000 * c3 - 2, N + T - 3); c4 += 1) + for (int c4 = max(2 * T + 4000 * c3 - 4001, T); c4 < min(2 * T + 4000 * c3 - 1, N + T - 2); c4 += 1) s6(2, T - 1, 1, -T + c4 + 1, 1); } diff --git a/test_inputs/codegen/omega/ts1d-orig0-0.c b/test_inputs/codegen/omega/ts1d-orig0-0.c index 13eb41c4..9eff756c 100644 --- a/test_inputs/codegen/omega/ts1d-orig0-0.c +++ b/test_inputs/codegen/omega/ts1d-orig0-0.c @@ -1,10 +1,10 @@ { - for (int c1 = 0; c1 <= N - 1; c1 += 1) + for (int c1 = 0; c1 < N; c1 += 1) s0(1, c1, 1, 0, 0); - for (int c1 = 0; c1 <= T - 1; c1 += 1) { - for (int c3 = 0; c3 <= N - 1; c3 += 1) + for (int c1 = 0; c1 < T; c1 += 1) { + for (int c3 = 0; c3 < N; c3 += 1) s1(2, c1, 0, c3, 1); - for (int c3 = 1; c3 <= N - 2; c3 += 1) + for (int c3 = 1; c3 < N - 1; c3 += 1) s2(2, c1, 1, c3, 1); } } -- 2.11.4.GIT