[Bug tree-optimization/98813] loop is sub-optimized if index is unsigned int with offset

guojiufu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 25 03:51:43 GMT 2021


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

--- Comment #2 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
For code:
  for (unsigned int k = 0;  k < BS; k++)
    {
      s += A[k] * B[k];
    }

PR48052 handles this, and for this code, the additional runtime check seems not
required. 

If there is offset in code:
  for (unsigned int k = 0;  k < BS; k++)
    {
      s += A[k+3] * B[k+3];
    }
This code is not vectorized then.


More information about the Gcc-bugs mailing list