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

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


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

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |WAITING

--- Comment #6 from Steven Bosscher <steven at gcc dot gnu.org> ---
What code is expected in this really old bug? Trunk x86-64 today:

int h(int *a);
struct G
{
int t;
int t1;
};
static int g1(struct G*);
int f1(int i, int j)
{
  struct G nestedf1={i,j};
  return g1(&nestedf1)+nestedf1.t1;
}
__attribute__((noinline))
static int g1(struct G *nestedf1)
{
  return h(&nestedf1->t)+ nestedf1->t1;
}



g1(G*):
        pushq   %rbx
        movq    %rdi, %rbx
        call    h(int*)
        addl    4(%rbx), %eax
        popq    %rbx
        ret
f1(int, int):
        subq    $24, %rsp
        movl    %edi, 8(%rsp)
        leaq    8(%rsp), %rdi
        movl    %esi, 12(%rsp)
        call    g1(G*)
        addl    12(%rsp), %eax
        addq    $24, %rsp
        ret


More information about the Gcc-bugs mailing list