<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/80032>80032</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            IPO const prop effectively inlines noinline functions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          rscottmanley
      </td>
    </tr>
</table>

<pre>
    The following example shows that IPSCCP is effectively inlining functions marked with noinline at optimization levels -O1 and above. 

```
#include <stdio.h>

__attribute__((noinline))
float value() {
  return 3.14159f;
}

int main() {
  printf("%f", value());
  return 0;
}
```

the assembly output from clang at -O1:

```
$ clang -O1 -S noinline.c
$ grep -A12 "^main" noinline.s
main: # @main
        .cfi_startproc
# %bb.0:
 pushq   %rax
        .cfi_def_cfa_offset 16
        leaq .L.str(%rip), %rdi
        movsd   .LCPI1_0(%rip), %xmm0           # xmm0 = mem[0],zero
        movb    $1, %al
        callq   printf@PLT
 xorl    %eax, %eax
        popq    %rcx
        .cfi_def_cfa_offset 8
        retq
```

This can also be seen in LLVM IR with just running the ipsccp pass where the functions are annotated with noinline here: https://godbolt.org/z/4jveedYoP

By contrast, gcc does not inline `value()` even at -O3 or -Ofast


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVFtvqzgQ_jXOyyjIGMjlgYc2OZEqddVoz9FK-xQZMwR3jU3tIb38-pUJ26QXHS2yQNjffDPzeWZkCPpoEUtW3LJiO5MDtc6XPihH1Elr8HVWufq1_NUiNM4Y96ztEfBFdr1BCK17DkCtJLjb_9xs9qADYNOgIn1C8wraGm2jRTNYRdrZAJ30_2ANz5pasG4EIEgC15Pu9JuMKDB4QhNg_pCCtDXIyp0wAca3jN9M7wWf1vlXZNoqM9QILNsEqrVLWpb9uDY5HCSR19VAeDgwsWJi9V8ATKzjGmGNcZLgJM2AI2gNbHl7PgLwS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