aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2015-12-08 14:17:42 +0000
committerTom de Vries <vries@gcc.gnu.org>2015-12-08 14:17:42 +0000
commit8498c16b04adcd57a409130c8c6d794708de814a (patch)
tree5d5e873c64683eb03b2bf89542e520f9abc5af4e
parent9b340934694e541e99701346263cb0f6c53b4438 (diff)
downloadgcc-8498c16b04adcd57a409130c8c6d794708de814a.zip
gcc-8498c16b04adcd57a409130c8c6d794708de814a.tar.gz
gcc-8498c16b04adcd57a409130c8c6d794708de814a.tar.bz2
Clear restrict in install_var_field
2015-12-08 Tom de Vries <tom@codesourcery.com> PR tree-optimization/68640 * omp-low.c (install_var_field): Clear the restrict qualifier on the var type. From-SVN: r231411
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/omp-low.c7
-rw-r--r--gcc/testsuite/gcc.dg/gomp/pr68640.c16
3 files changed, 29 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d45a2a7..94331ed 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-12-08 Tom de Vries <tom@codesourcery.com>
+
+ PR tree-optimization/68640
+ * omp-low.c (install_var_field): Clear the restrict qualifier on the var
+ type.
+
2015-12-08 Kirill Yukhin <kirill.yukhin@intel.com>
* config/i386/sse.md (define_insn "<avx512>_vec_dup<mode>_1"): Fix
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index d1d1e3c..5643480 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1389,6 +1389,13 @@ install_var_field (tree var, bool by_ref, int mask, omp_context *ctx,
|| !is_gimple_omp_oacc (ctx->stmt));
type = TREE_TYPE (var);
+ /* Prevent redeclaring the var in the split-off function with a restrict
+ pointer type. Note that we only clear type itself, restrict qualifiers in
+ the pointed-to type will be ignored by points-to analysis. */
+ if (POINTER_TYPE_P (type)
+ && TYPE_RESTRICT (type))
+ type = build_qualified_type (type, TYPE_QUALS (type) & ~TYPE_QUAL_RESTRICT);
+
if (mask & 4)
{
gcc_assert (TREE_CODE (type) == ARRAY_TYPE);
diff --git a/gcc/testsuite/gcc.dg/gomp/pr68640.c b/gcc/testsuite/gcc.dg/gomp/pr68640.c
new file mode 100644
index 0000000..f333db0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gomp/pr68640.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-ealias-all" } */
+
+#define N 1024
+
+int
+foo (int *__restrict__ ap)
+{
+ int *bp = ap;
+#pragma omp parallel for
+ for (unsigned int idx = 0; idx < N; idx++)
+ ap[idx] = bp[idx];
+}
+
+/* { dg-final { scan-tree-dump-times "clique 1 base 1" 2 "ealias" } } */
+/* { dg-final { scan-tree-dump-times "(?n)clique .* base .*" 2 "ealias" } } */