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

--- Comment #9 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
---
static bool next_ci(int dimYY, int numCells, int nth, int ci_block, int* ci_x,
int* ci_y, int* ci_b, int* ci)
{
    while (*ci >= *ci_x * dimYY + *ci_y + 1)
    {
        *ci_y += 1;
        if (*ci_y == dimYY)
        {
            *ci_x += 1;
            *ci_y = 0;
        }
    }

    return 1;
}

void foo (int th, int ci_block, int dimYY, int numCells, int nth)
{
    int ci_b = -1;
    int ci   = th * ci_block - 1;
    int ci_x = 0;
    int ci_y = 0;

    while (next_ci(dimYY, numCells, nth, ci_block, &ci_x, &ci_y, &ci_b, &ci))
    {
        asm volatile ("");
    }
}
---

This reproduces the loop, but I don't see anything wrong here...
https://godbolt.org/z/x9aqn4Y1W  I'll next try to see if I can make it fail
with a runtime test.

But the codegen looks fine.. the missing LCSSI is fine as it's an induction
that needs to be recomputed anyway..

For a marked target, reaching the end of the main loop means:

  # _73 = PHI <_9(5)>
  _52 = niters.4_38;
  _54 = (int) _52;
  tmp.5_53 = ci_y_16 + _54;
  if (niters.4_38 == _52)
    goto <bb 6>; [25.00%]
  else
    goto <bb 16>; [75.00%]

seems correct..

Reply via email to