https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66288

            Bug ID: 66288
           Summary: parallelized loop vectorized with runtime alias check
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Another pr46032-inspired example.

Consider par-3.c:
...
#if defined (EXEC)
static void __attribute__((noinline,noclone))
init (double *p, int n)
{
  int i;
  for (i = 0; i < n; ++i)
    p[i] = 0.0;
}
#else
extern void init (double *, int);
#endif

#define nEvents 1000

int
main (int argc)
{
  double results[nEvents];
  double data[nEvents];
  double coeff = 12.2;

  init (data, nEvents);
  init (results, nEvents);

  for (INDEX_TYPE idx = 0; idx < nEvents; idx++)
    results[idx] = coeff * data[idx];

  return !(results[argc] == 0.0);
}
...

we compile using this command-line:
...
gcc -O2 -ftree-parallelize-loops=2 -ftree-vectorize -S -fdump-tree-all-all
par-3.c -DINDEX_TYPE="unsigned long"
...

[ When using any other INDEX_TYPE than unsigned long, we run into what looks
like PR66285. ]

In the vectorize dump file, we find:
...
par-3.c:26:32: note: versioning for alias required: can't determine dependence
between *data_4[ivtmp_20] and *results_5[ivtmp_20]
par-3.c:26:32: note: mark for run-time aliasing test between *data_4[ivtmp_20]
and *results_5[ivtmp_20]
...

Reply via email to