Bug 109271 - Unnecessary vectorization alias versioning check
Summary: Unnecessary vectorization alias versioning check
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks: vectorizer
  Show dependency treegraph
 
Reported: 2023-03-24 07:27 UTC by Richard Biener
Modified: 2023-03-27 10:24 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2023-03-24 07:27:26 UTC
Split out from PR80198

void __attribute__((noipa)) generic(int * a, int * b, int c)
{
  int i;
  a = __builtin_assume_aligned (a, 16);
  b = __builtin_assume_aligned (b, 16);
  for (i=0; i < 256; i++) {
      a[i] = b[i] | c;
  }
}

is versioned for aliasing by the vectorizer, not realizing the alignment
guarantees allow vectorizing with 16byte vectors without.  Actually
the CCP pass after the vectorizer is able to elide the check, so this
but is merely to track the cost side of this (also when mixed with
a more complex required versioning check it might fail to optimize later).
Comment 1 Richard Biener 2023-03-24 07:37:56 UTC
A related(?) case from the same PR is the following where one could argue
we should have propagated the equivalence.

void __attribute__((noinline)) generic(int * a, int * b, int c)
{
  if (a == b) {
      for (int i=0; i < 256; i++) {
          a[i] = b[i] | c;
      }
  }
}