aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFrederik Harwath <frederik@codesourcery.com>2023-05-04 18:09:23 +0200
committerFrederik Harwath <frederik@codesourcery.com>2023-05-04 18:09:23 +0200
commit07fc54f7f09b79133e296cbdf87a2e6dd02e4eda (patch)
treec1842ea38f65dd628c1024e6855e9a8ac03b87ae /gcc
parenta410f603fcaf2b963af5607eb359907fe273426e (diff)
downloadgcc-07fc54f7f09b79133e296cbdf87a2e6dd02e4eda.zip
gcc-07fc54f7f09b79133e296cbdf87a2e6dd02e4eda.tar.gz
gcc-07fc54f7f09b79133e296cbdf87a2e6dd02e4eda.tar.bz2
openmp: Fix initialization for 'unroll full'
The index variable initialization for the 'omp unroll' directive with 'full' clause got lost and the testsuite did not catch it. Add the initialization and add -Wall to some tests to detect uninitialized variable uses and other potential problems in the code generation. gcc/ChangeLog: * omp-transform-loops.cc (full_unroll): Add initialization of index variable. libgomp/ChangeLog: * testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-unroll-full-1.c: Use -Wall and add -Wno-unknown-pragmas to disable warnings about empty pragmas. Use -O2. * testsuite/libgomp.c++/loop-transforms/matrix-no-directive-unroll-full-1.C: Copy of testsuite/libgomp.c-c++-common/matrix-no-directive-unroll-full-1.c, but using -O0 which works only for C++. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-no-directive-1.c: Use -Wall and use -Wno-unknown-pragmas to disable warnings about empty pragmas. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-distribute-parallel-for-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-for-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-for-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-parallel-masked-taskloop-simd-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-parallel-for-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-target-teams-distribute-parallel-for-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-taskloop-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-omp-teams-distribute-parallel-for-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/matrix-simd-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/unroll-non-rect-1.c: Likewise. * testsuite/libgomp.c-c++-common/loop-transforms/unroll-1.c: Likewise and fix broken function calls found by -Wall.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.omp4
-rw-r--r--gcc/omp-transform-loops.cc1
2 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index c8a12d1..d70e905 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,7 @@
+2023-05-04 Frederik Harwath <frederik@codesourcery.com>
+
+ * omp-transform-loops.cc (full_unroll): Add initialization of index variable.
+
2023-04-27 Andrew Stubbs <ams@codesourcery.com>
* config/gcn/gcn-valu.md (cmul<conj_op><mode>3): Use gcn_gen_undef.
diff --git a/gcc/omp-transform-loops.cc b/gcc/omp-transform-loops.cc
index ce8e8f3..f589c31 100644
--- a/gcc/omp-transform-loops.cc
+++ b/gcc/omp-transform-loops.cc
@@ -542,6 +542,7 @@ full_unroll (gomp_for *omp_for, location_t loc, walk_ctx *ctx ATTRIBUTE_UNUSED)
gimple_seq unrolled = NULL;
gimple_seq_add_seq (&unrolled, gimple_omp_for_pre_body (omp_for));
+ gimplify_assign (index, init, &unrolled);
push_gimplify_context ();
gimple_seq_add_seq (&unrolled,
build_unroll_body (body, unroll_factor, index, incr));