aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-01-19 21:00:08 +0100
committerJakub Jelinek <jakub@redhat.com>2023-01-19 21:00:08 +0100
commit46644ec99cb355845b23bb1d02775c057ed8ee88 (patch)
tree6337106ebc645131d1f267b8ea906b85f7f5cada /gcc
parent0d6f7b1dd62e9c9dccb0b9b673f9cc3238b7ea6d (diff)
downloadgcc-46644ec99cb355845b23bb1d02775c057ed8ee88.zip
gcc-46644ec99cb355845b23bb1d02775c057ed8ee88.tar.gz
gcc-46644ec99cb355845b23bb1d02775c057ed8ee88.tar.bz2
openmp: Fix up OpenMP expansion of non-rectangular loops [PR108459]
expand_omp_for_init_counts was using for the case where collapse(2) inner loop has init expression dependent on non-constant multiple of the outer iterator and the condition upper bound expression doesn't depend on the outer iterator fold_unary (NEGATE_EXPR, ...). This will just return NULL if it can't be folded, we need fold_build1 instead. 2023-01-19 Jakub Jelinek <jakub@redhat.com> PR middle-end/108459 * omp-expand.cc (expand_omp_for_init_counts): Use fold_build1 rather than fold_unary for NEGATE_EXPR. * testsuite/libgomp.c/pr108459.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/omp-expand.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index c7ef419..940454b 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -2003,8 +2003,8 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
t = fold_build2 (MINUS_EXPR, itype, unshare_expr (fd->loops[i].m2),
unshare_expr (fd->loops[i].m1));
else if (fd->loops[i].m1)
- t = fold_unary (NEGATE_EXPR, itype,
- unshare_expr (fd->loops[i].m1));
+ t = fold_build1 (NEGATE_EXPR, itype,
+ unshare_expr (fd->loops[i].m1));
else
t = unshare_expr (fd->loops[i].m2);
tree m2minusm1