[Bug tree-optimization/76957] [7 regression] FAIL: gcc.dg/graphite/scop-dsyr2k.c scan-tree-dump-times graphite "number of SCoPs

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 25 13:08:00 GMT 2017


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amker at gcc dot gnu.org

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Testcase for the niter analysis issue:

#define NMAX 3000

static double a[NMAX][NMAX], b[NMAX][NMAX], c[NMAX][NMAX];

void dsyr2k(int N)
{
  int i,j,k;

  if (N > 0)
    {
      i = 0;
      do
        {
          j = 0;
          do
            {
              k = j;
              do
                {
                  c[j][k] += a[i][j] * b[i][k] + b[i][j] * a[i][k];
                  k++;
                }
              while (k < N);
              j++;
            }
          while (j<N);
          i++;
        }
      while (i < N);
    }
}

for the innermost (k) loop we get

Analyzing # of iterations of loop 3
  exit condition [j_11 + 1, + , 1](no_overflow) < N_17(D)
  bounds on difference of bases: -2999 ... 2147483646
  result:
    zero if j_11 >= N_17(D)
    # of iterations ((unsigned int) N_17(D) - (unsigned int) j_11) - 1, bounded
by 2147483646

as it fails to simplify this zero-if condition.  If it would look at
the evolution of j_11 (the IV PHI of the j loop) which is {0, +, 1}_2
it would see together with

Analyzing # of iterations of loop 2
  exit condition [1, + , 1](no_overflow) < N_17(D)
  bounds on difference of bases: 0 ... 2147483646
  result:
    # of iterations (unsigned int) N_17(D) + 4294967295, bounded by 2147483646

and thus 1 * (N_17 - 1) >= N_17 is always false.

From the gcc.dg/graphite/scop-dsyr2k.c we now arrive at the above IL via
improved jump threading, optimizing out redundant loop header checks
(but as shown above IVO cannot recover).


More information about the Gcc-bugs mailing list