public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1886] openmp: Simplify fold_build_pointer_plus callers in omp-expand Date: Fri, 29 Jul 2022 07:48:38 +0000 (GMT) [thread overview] Message-ID: <20220729074838.8F8BB38582AA@sourceware.org> (raw) https://gcc.gnu.org/g:4796d16de657d7c2720471e61432de0f4a5cb6df commit r13-1886-g4796d16de657d7c2720471e61432de0f4a5cb6df Author: Jakub Jelinek <jakub@redhat.com> 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 <jakub@redhat.com> * 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),
reply other threads:[~2022-07-29 7:48 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220729074838.8F8BB38582AA@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).