[Bug tree-optimization/17217] not removing removal of nested structs

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 4 13:46:00 GMT 2019


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
     Ever confirmed|1                           |0

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Steven Bosscher from comment #6)
> What code is expected in this really old bug? Trunk x86-64 today:
> __attribute__((noinline))

g1 is not to be noinline for the nested testcase.

The un-nested testcase is actually should not be optimized.
The nested function testcase shows the issue.
For the original testcase:
int h(int *a);
int f(int i, int j)
{
  int t = i;
  int t1 = j;
  int g()
  {
     return h(&t) + t1;
  }
  return g() + t1;
}

We should optimize this to the same as:
int h(int *a);
int f(int i, int j)
{
  return h(&t) + 2 * j;
}


More information about the Gcc-bugs mailing list