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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-09-25
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The difference starts in cunrolli.
-O2 does a decent job at unrolling this mess:
  goto <bb 9>; [100.00%]

  <bb 3> [local count: 4278941306]:
  j[g_10] = &b;

  <bb 4> [local count: 8557882624]:
  # h_11 = PHI <1(3), 0(7)>
  if (h_11 == 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 5> [local count: 4278941306]:
  g_12 = g_10 + 1;

  <bb 6> [local count: 12966488877]:
  # g_10 = PHI <g_12(5), 0(10)>
  if (g_10 != 3)
    goto <bb 7>; [33.00%]
  else
    goto <bb 8>; [67.00%]

  <bb 7> [local count: 4278941306]:
  goto <bb 4>; [100.00%]

  <bb 8> [local count: 8687547571]:
  _13 = j[0];
  a = _13;
  j ={v} {CLOBBER};
  c.2_14 = c;
  *c.2_14 = &b;
  _16 = f.4_15 + 1;
  f = _16;

  <bb 9> [local count: 9761289395]:
  f.4_15 = f;
  if (f.4_15 <= 0)
    goto <bb 10>; [89.00%]
  else
    goto <bb 11>; [11.00%]

  <bb 10> [local count: 8687547571]:
  goto <bb 6>; [100.00%]

But -O3 does not but It gets almost cleared up before pre but the -O3 case we
have:
  f = 0;
  a = &b;
  j ={v} {CLOBBER};
  c.2_14 = c;
  *c.2_14 = &b;
  f = 1;
  a.0_1 = a;
  *a.0_1 = 0;
  c.1_2 = c;
  _3 = *c.1_2;
  _4 = *_3;

While in the -O2 case we have:
  f = 0;
  a = &b;
  c.2_14 = c;
  *c.2_14 = &b;
  f = 1;
  a.0_1 = a;
  *a.0_1 = 0;
  c.1_2 = c;
  _3 = *c.1_2;
  _4 = *_3;

The clobber is getting in the way of pre.

Reply via email to