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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Header-less version of the testcase:
typedef __SIZE_TYPE__ size_t;

__attribute__((always_inline)) static inline void
copy (int *restrict a, int *restrict b)
{
  *b = *a;
  *a = 7;
}

__attribute__((noinline)) void
floppy (int *mat, size_t *idxs)
{
  for (int i = 0; i < 3; i++)
    copy (&mat[i%2], &mat[idxs[i]]);
}

int
main ()
{
  int mat[2] = {10, 20};
  size_t idxs[3] = {1, 0, 1};
  floppy (mat, idxs);
  if (mat[0] != 7 || mat[1] != 10)
    __builtin_abort ();
  return 0;
}

Richi, any progress on this?  How should the loop unrolling determine when to
use different base/clique and when to use the same?  I mean, isn't it different
if each loop body invokes another inlined call with restrict args vs. when the
loop is within the same original function?

Reply via email to