aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-expand.cc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2023-08-19 07:49:06 +0200
committerTobias Burnus <tobias@codesourcery.com>2023-08-19 07:49:06 +0200
commit1dc65003b66e5a97200f454eeddcccfce34416b3 (patch)
treea66ea487511391b38a336b33dd7a625997764c43 /gcc/omp-expand.cc
parent3e3157363863ed599c367645af4f94ae32a5bdc2 (diff)
downloadgcc-1dc65003b66e5a97200f454eeddcccfce34416b3.zip
gcc-1dc65003b66e5a97200f454eeddcccfce34416b3.tar.gz
gcc-1dc65003b66e5a97200f454eeddcccfce34416b3.tar.bz2
omp-expand.cc: Fix wrong code with non-rectangular loop nest [PR111017]
Before commit r12-5295-g47de0b56ee455e, all gimple_build_cond in expand_omp_for_* were inserted with gsi_insert_before (gsi_p, cond_stmt, GSI_SAME_STMT); except the one dealing with the multiplicative factor that was gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING); That commit for PR103208 fixed the issue of some missing regimplify of operands of GIMPLE_CONDs by moving the condition handling to the new function expand_omp_build_cond. While that function has an 'bool after = false' argument to switch between the two variants. However, all callers ommited this argument. This commit reinstates the prior behavior by passing 'true' for the factor != 0 condition, fixing the included testcase. PR middle-end/111017 gcc/ * omp-expand.cc (expand_omp_for_init_vars): Pass after=true to expand_omp_build_cond for 'factor != 0' condition, resulting in pre-r12-5295-g47de0b56ee455e code for the gimple insert. libgomp/ * testsuite/libgomp.c-c++-common/non-rect-loop-1.c: New test.
Diffstat (limited to 'gcc/omp-expand.cc')
-rw-r--r--gcc/omp-expand.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index db58b3c..1a4d625 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -2562,7 +2562,8 @@ expand_omp_for_init_vars (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
tree factor = fd->factor;
gcond *cond_stmt
= expand_omp_build_cond (gsi, NE_EXPR, factor,
- build_zero_cst (TREE_TYPE (factor)));
+ build_zero_cst (TREE_TYPE (factor)),
+ true);
edge e = split_block (gsi_bb (*gsi), cond_stmt);
basic_block bb0 = e->src;
e->flags = EDGE_TRUE_VALUE;