[Bug tree-optimization/126366] New: Re-alignment for early break ineffective on x86

"rguenth at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126366

            Bug ID: 126366
           Summary: Re-alignment for early break ineffective on x86
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
            Blocks: 53947
  Target Milestone: ---
            Target: x86_64-*-*

char b[100];
int c(int a) {
  unsigned d = 0;
  for (; d < a; ++d)
    {
      if (b[0] + b[d + 1])
        return 0;
    }
  return 1;
}

fails to be vectorized with AVX512 - we chose to align b[], but that does
not help to make b[1] aligned.  I suspect the failure to consider
alignment peeling by mask is the reason this doesn't vectorize on x86 but
is vectorized with RVV.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.