diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-07-29 09:43:34 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-07-29 09:43:34 +0200 |
commit | 4796d16de657d7c2720471e61432de0f4a5cb6df (patch) | |
tree | 19789cfa6988d7b92eec771f0740334a10faaa04 /gcc | |
parent | 201e8d9f82444403682cd583ce0a03e3e3dd2b73 (diff) | |
download | gcc-4796d16de657d7c2720471e61432de0f4a5cb6df.zip gcc-4796d16de657d7c2720471e61432de0f4a5cb6df.tar.gz gcc-4796d16de657d7c2720471e61432de0f4a5cb6df.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/omp-expand.cc | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc index 1023c56..9cc61fe 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), |