http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50661

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-08 
12:20:34 UTC ---
One possibility would be some fallthru hint to the compiler similar to
__builtin_assume_aligned that would tell the compiler that certain range of
bytes will not trap/fault on reading and thus it is safe to read it
speculatively.
ptr = __builtin_assume_object_size (ptr, length);
or similar.  You could just insert it before the loop and let it be vectorized.
But I believe we don't vectorize even
void *array1[1024], *array2[1024];
int foo (void)
{
  int i;
  for (i = 0; i < 1024; i++)
    if (array1[i] != array2[i])
      break;
  return i == n;
}
where the will not fault/trap for i 0 .. 1023 is already known (or can be
known).

Reply via email to