Skip to content

Inline "noinline" function if becomes empty #49355

@davidbolvansky

Description

@davidbolvansky
Bugzilla Link 50011
Version trunk
OS Linux
CC @aeubanks,@alinas,@dwblaikie,@mtrofin

Extended Description

static void *ptr1, *ptr2;

static void doit(void **pptr, int cond)
{
  if (cond) {
    *pptr = &ptr2;
  }
}

__attribute__ ((noinline))
static void f(int cond)
{
  doit (&ptr1, cond);
}


int main()
{
  f (1);
}



llvm -O3:
main:                                   # @​main
        push    rax
        call    f
        xor     eax, eax
        pop     rcx
        ret
f:                                      # @​f
        ret

https://godbolt.org/z/7387cer5j

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions