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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |100314

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Here the stack frame size of i is stimated to 244 bytes
void i ()
{
  int p[8];
  int n[27];
  int k[24];
  int l;
  int j;
  int _1;
  int _2;
  int _3;
  int c.2_4;
  int _5;

  <bb 2> [local count: 236223200]:
  l = 0;
  k = {};
  h = &n;
  _1 = n[0];
  _2 = _1 & 1;
  if (_2 != 0)
    goto <bb 8>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 8> [local count: 118111600]:
  goto <bb 4>; [100.00%]

  <bb 3> [local count: 955630225]:
  _3 = c.2_4 + -1;
  c = _3;

  <bb 4> [local count: 1073741824]:
  c.2_4 = c;
  if (c.2_4 != 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 5>; [11.00%]

  <bb 5> [local count: 236223200]:
  h = &p;
  _5 = p[0];
  if (_5 != 0)
    goto <bb 6>; [50.00%]
  else
    goto <bb 7>; [50.00%]

  <bb 6> [local count: 118111600]:
  h = &j;

  <bb 7> [local count: 236223200]:
  e = 0;
  j ={v} {CLOBBER};
  l ={v} {CLOBBER};
  k ={v} {CLOBBER};
  n ={v} {CLOBBER};
  p ={v} {CLOBBER};
  return;

}

so it indeed has larger arrays. k is initialized but never used (so it is
missed DSE). n is used in stupid way:

  h = &n;                                                                       
  _1 = n[0];                                                                    

where h is write only static var, but we do not know that during early opts (we
could try our luck and schedule one extra writeonly detection before early
optimization passes, but I am not sure it is worth).

I would say that main issue is also missed DSE


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100314
[Bug 100314] missed optimization for dead code elimination at -O3 (vs. -O1) 
(inlining differences due to missed dse)

Reply via email to