Question on higher degree polynomial in scalar evolution

Bin.Cheng amker.cheng@gmail.com
Wed Feb 6 06:27:00 GMT 2013


Hi,
Considering below program,

extern int d;

int func(void)
{
    int a, b, c;
    a = 2;
    c = 5;
    do
    {
    b = a + 1;
    d = a + c;
    a = b;
    c = d;
    } while (a < 100);

    return 0;
}

The gimple dump before pass_scev_cprop is like:

  <bb 2>:

  <bb 3>:
  # a_1 = PHI <2(2), a_5(4)>
  # c_2 = PHI <5(2), c_6(4)>
  a_5 = a_1 + 1;
  c_6 = a_1 + c_2;
  if (a_5 != 100)
    goto <bb 4>;
  else
    goto <bb 5>;

  <bb 4>:
  goto <bb 3>;

  <bb 5>:
  # d_lsm.4_12 = PHI <c_6(3)>
  d = d_lsm.4_12;
  return 0;

When analyzing c_2=PHI<5,c_6> in scev_const_prop, resolver_mixers
returns chrec_dont_know, rather than {5, +, 2, +, 1}.
So two questions about this:
1. Is it expected to handle higher degree polynomial lie this?
If yes,
2. does it mean we don't use higher degree in misc. loop optimizations in GCC?

I just started reading this part of code, so please correct if I
missed something.

Thanks in advance.

--
Best Regards.



More information about the Gcc mailing list