[Bug tree-optimization/70614] [4.9/5/6 Regression] GCC gets stuck with -O

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 11 12:50:00 GMT 2016


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Even on the following testcase at -O2 we end up with over 2000000
analyze_scalar_evolution calls (while that finishes within a second and half,
it still looks very much excessive to me).  Perhaps we should have similar
param like we have for max-ssa-name-query-depth (certainly not as tight) and
simply give up if we recurse more than that during computation of SCEV?

struct S
{
  int *s;
};
int a, b, c, d, e, f, *g, *h;
void
foo (struct S *t)
{
  int *i;
lab1:
  switch (0)
    {
    case 0:
      switch (0)
        {
        case 0:
        case 1:
          if (((struct S *) t)->s)
            goto lab4;
        }
    }
  f = 0;
lab2:
  if (i)
    goto lab3;
  if (h)
    g = 0;
  goto lab4;
lab3:
  if ((int) i)
    {
      i = i;
      goto lab2;
    }
lab4:
lab5:
  switch (a)
    {
    case 1:
      if (0)
        goto lab8;
      switch (1)
        {
        case 1:
          if ((int) ((struct S *) t)->s)
            switch (0)
              {
              case 0:
                switch (e)
                  {
                  case 0:
                    switch (c)
                      {
                      case 0:
                        if (((struct S *) t)->s)
                        lab6:
                          switch (d)
                            {
                            case 0:
                              if ((int) ((struct S *) t)->s & 1)
                                goto lab8;
                            lab7:
                              if (i)
                                i = 0;
                            }
                      }
                  }
              }
        case 0:
          goto lab8;
        }
    case 0:
      if (a)
        goto lab5;
    }
lab8:
lab9:
  if (a)
    goto lab9;
  switch ((int) g)
    {
    case 0:
      switch (b)
        {
        case 0:
          if (((struct S *) t)->s)
            switch (e)
              {
              case 0:
                if ((int) ((struct S *) t)->s)
                  i = 1;
              }
        }
    }
lab10:
  if (h)
    goto lab10;
  switch ((int) i)
    {
    case 0:
      goto lab1;
    }
}


More information about the Gcc-bugs mailing list