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

            Bug ID: 118215
           Summary: Miss runtime alias check for vectorization
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxue at os dot amperecomputing.com
  Target Milestone: ---

The following case could not be vectorized by gcc, but could by llvm trunk,
which introduces multiversioning with runtime alias checks among "sum" and "a",
"b".

  void foo(const char *a, const char *b, int stride, int n, int *sum)
  {
    *sum = 0;

    for (int i = 0; i < n; ++i) {

      #pragma GCC unroll 0
      for (int j = 0; j < 16; ++j) {
        *sum += a[j] - b[j];
      }

      a += stride;
      b += stride;
    }
  }

Reply via email to