This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, PR68640] Clear restrict in install_var_field


On 08/12/15 10:22, Richard Biener wrote:
On Tue, 8 Dec 2015, Jakub Jelinek wrote:

On Tue, Dec 08, 2015 at 09:49:49AM +0100, Tom de Vries wrote:
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index d1d1e3c..ac4a94d 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1389,6 +1389,12 @@ 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 = build_qualified_type (type, TYPE_QUALS (type) & ~TYPE_QUAL_RESTRICT);

Is it necessary to call build_qualified_type in the common case (when it is
not restrict)?  I'd think if (POINTER_TYPE_P (type) && TYPE_RESTRICT (type))
might be better.


Will do.

That said, I forgot when exactly are the cliques computed, it would be nice
if then computing those and seeing a
GOMP_parallel/GOACC_parallel_keyed/GOMP_target_ext/GOMP_task/GOMP_taskloop*
builtins we would just continue walking the outlined functions they refer to
as if it was a part of the current function for the purpose of the restrict
computation.

Cliques are not computed in IPA PTA and the above would require IPA.

FTR, this is a generic (not openmp-related) example, and AFAIU a more generic form of the issue that is being raised.
...
static void __attribute__((noinline, noclone))
bar (int *a, int * b)
{
  *a = 1;
  *b = 2;
  *a = *a + 1;
}

void
foo (int *__restrict__ a, int *__restrict__ b)
{
  bar (a, b);
}
...

Thanks,
- Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]