From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 8F8BB38582AA; Fri, 29 Jul 2022 07:48:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F8BB38582AA MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1886] openmp: Simplify fold_build_pointer_plus callers in omp-expand X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 201e8d9f82444403682cd583ce0a03e3e3dd2b73 X-Git-Newrev: 4796d16de657d7c2720471e61432de0f4a5cb6df Message-Id: <20220729074838.8F8BB38582AA@sourceware.org> Date: Fri, 29 Jul 2022 07:48:38 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2022 07:48:38 -0000 https://gcc.gnu.org/g:4796d16de657d7c2720471e61432de0f4a5cb6df commit r13-1886-g4796d16de657d7c2720471e61432de0f4a5cb6df Author: Jakub Jelinek Date: Fri Jul 29 09:43:34 2022 +0200 openmp: Simplify fold_build_pointer_plus callers in omp-expand Tobias mentioned in PR106449 that fold_build_pointer_plus already fold_converts the second argument to sizetype if it doesn't already have an integral type gimple compatible with sizetype. So, this patch simplifies the callers of fold_build_pointer_plus in omp-expand so that they don't do those conversions manually. 2022-07-29 Jakub Jelinek * omp-expand.cc (expand_omp_for_init_counts, expand_omp_for_init_vars, extract_omp_for_update_vars, expand_omp_for_ordered_loops, expand_omp_simd): Don't fold_convert second argument to fold_build_pointer_plus to sizetype. Diff: --- gcc/omp-expand.cc | 51 +++++++++++++++------------------------------------ 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc index 1023c56fc3d..9cc61fed9f8 100644 --- a/gcc/omp-expand.cc +++ b/gcc/omp-expand.cc @@ -2267,8 +2267,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, else if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[i].m1)); - t = fold_convert (sizetype, - unshare_expr (fd->loops[i].n1)); + t = unshare_expr (fd->loops[i].n1); n1 = fold_build_pointer_plus (vs[i - fd->loops[i].outer], t); } else @@ -2291,8 +2290,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, else if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[i].m2)); - t = fold_convert (sizetype, - unshare_expr (fd->loops[i].n2)); + t = unshare_expr (fd->loops[i].n2); n2 = fold_build_pointer_plus (vs[i - fd->loops[i].outer], t); } else @@ -2353,8 +2351,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi, tree step = fold_convert (itype, unshare_expr (fd->loops[i].step)); if (POINTER_TYPE_P (TREE_TYPE (vs[i]))) - t = fold_build_pointer_plus (vs[i], - fold_convert (sizetype, step)); + t = fold_build_pointer_plus (vs[i], step); else t = fold_build2 (PLUS_EXPR, itype, vs[i], step); t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE, @@ -2794,8 +2791,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, else if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[j].m1)); - t = fold_convert (sizetype, - unshare_expr (fd->loops[j].n1)); + t = unshare_expr (fd->loops[j].n1); n1 = fold_build_pointer_plus (vs[j - fd->loops[j].outer], t); } else @@ -2818,8 +2814,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, else if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[j].m2)); - t = fold_convert (sizetype, - unshare_expr (fd->loops[j].n2)); + t = unshare_expr (fd->loops[j].n2); n2 = fold_build_pointer_plus (vs[j - fd->loops[j].outer], t); } else @@ -2895,8 +2890,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, tree step = fold_convert (itype, unshare_expr (fd->loops[j].step)); if (POINTER_TYPE_P (vtype)) - t = fold_build_pointer_plus (vs[j], fold_convert (sizetype, - step)); + t = fold_build_pointer_plus (vs[j], step); else t = fold_build2 (PLUS_EXPR, itype, vs[j], step); } @@ -2959,8 +2953,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, = fold_convert (itype, unshare_expr (fd->loops[j].step)); t = fold_build2 (MULT_EXPR, itype, t, t2); if (POINTER_TYPE_P (vtype)) - t = fold_build_pointer_plus (n1, - fold_convert (sizetype, t)); + t = fold_build_pointer_plus (n1, t); else t = fold_build2 (PLUS_EXPR, itype, n1, t); } @@ -2970,8 +2963,7 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, t = fold_build2 (MULT_EXPR, itype, t, fold_convert (itype, fd->loops[j].step)); if (POINTER_TYPE_P (vtype)) - t = fold_build_pointer_plus (fd->loops[j].n1, - fold_convert (sizetype, t)); + t = fold_build_pointer_plus (fd->loops[j].n1, t); else t = fold_build2 (PLUS_EXPR, itype, fd->loops[j].n1, t); } @@ -3035,9 +3027,8 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi, if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[i].m2)); - t = fold_convert (sizetype, unshare_expr (fd->loops[i].n2)); t = fold_build_pointer_plus (fd->loops[i - fd->loops[i].outer].v, - t); + unshare_expr (fd->loops[i].n2)); } else { @@ -3130,7 +3121,7 @@ extract_omp_for_update_vars (struct omp_for_data *fd, tree *nonrect_bounds, { if (POINTER_TYPE_P (TREE_TYPE (l->v))) t = fold_build_pointer_plus (fd->loops[i + 1 - l->outer].v, - fold_convert (sizetype, t)); + t); else { tree t2 @@ -3186,9 +3177,7 @@ extract_omp_for_update_vars (struct omp_for_data *fd, tree *nonrect_bounds, if (l->m1) { if (POINTER_TYPE_P (TREE_TYPE (l->v))) - t = fold_build_pointer_plus (fd->loops[i].v, - fold_convert (sizetype, - l->n1)); + t = fold_build_pointer_plus (fd->loops[i].v, l->n1); else { t = fold_build2 (MULT_EXPR, TREE_TYPE (l->m1), l->m1, @@ -3210,9 +3199,7 @@ extract_omp_for_update_vars (struct omp_for_data *fd, tree *nonrect_bounds, if (l->m2) { if (POINTER_TYPE_P (TREE_TYPE (l->v))) - t = fold_build_pointer_plus (fd->loops[i].v, - fold_convert (sizetype, - l->n2)); + t = fold_build_pointer_plus (fd->loops[i].v, l->n2); else { t = fold_build2 (MULT_EXPR, TREE_TYPE (l->m2), l->m2, @@ -3640,9 +3627,7 @@ expand_omp_for_ordered_loops (struct omp_for_data *fd, tree *counts, { gsi = gsi_last_bb (cont_bb); if (POINTER_TYPE_P (type)) - t = fold_build_pointer_plus (fd->loops[i].v, - fold_convert (sizetype, - fd->loops[i].step)); + t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step); else t = fold_build2 (PLUS_EXPR, type, fd->loops[i].v, fold_convert (type, fd->loops[i].step)); @@ -6669,10 +6654,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) { i = fd->collapse - 1; if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))) - { - t = fold_convert (sizetype, fd->loops[i].step); - t = fold_build_pointer_plus (fd->loops[i].v, t); - } + t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step); else { t = fold_convert (TREE_TYPE (fd->loops[i].v), @@ -6820,10 +6802,7 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) e = EDGE_SUCC (last_bb, 1); basic_block bb = split_edge (e); if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))) - { - t = fold_convert (sizetype, fd->loops[i].step); - t = fold_build_pointer_plus (fd->loops[i].v, t); - } + t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step); else { t = fold_convert (TREE_TYPE (fd->loops[i].v),