https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110052
--- Comment #3 from Bernhard Reutner-Fischer <aldot at gcc dot gnu.org> --- Note that in this particular case myrealloc() is static, maybe i should have omitted the noipa attribute for it was only meant to simplify analysis and there is no such attribute in the original code. Furthermore, i would have hoped that given the placement of the definition of myrealloc() before the typedef foo_t, it should be unlikely that the usage of *foo would invalidate such an optimisation _in this particular case_. While the original code unfortunately does not mark *foo as restrict, adding restrict would hopefully make it clear that myrealloc() has no business in comparing foo's struct members, i'd hope? When i drop the noipa attribute in the v1 testcase to make it similar to the motivating case, i get: 9: 0000000000000000 44 FUNC GLOBAL DEFAULT 4 bloat 12: 0000000000000000 38 FUNC GLOBAL DEFAULT 6 ok 0000000000000000 <bloat>: 0: 53 push %rbx 1: 48 83 7f 08 00 cmpq $0x0,0x8(%rdi) 6: 48 89 fb mov %rdi,%rbx 9: 8b 47 14 mov 0x14(%rdi),%eax c: 75 19 jne 27 <bloat+0x27> e: bf d0 01 00 00 mov $0x1d0,%edi 13: e8 00 00 00 00 callq 18 <bloat+0x18> 18: 48 85 c0 test %rax,%rax 1b: 75 05 jne 22 <bloat+0x22> 1d: e8 00 00 00 00 callq 22 <bloat+0x22> 22: b8 d0 01 00 00 mov $0x1d0,%eax 27: 89 43 14 mov %eax,0x14(%rbx) 2a: 5b pop %rbx 2b: c3 retq Disassembly of section .text.ok: 0000000000000000 <ok>: 0: 48 83 7f 08 00 cmpq $0x0,0x8(%rdi) 5: 75 1e jne 25 <ok+0x25> 7: 52 push %rdx 8: c7 47 14 d0 01 00 00 movl $0x1d0,0x14(%rdi) f: bf d0 01 00 00 mov $0x1d0,%edi 14: e8 00 00 00 00 callq 19 <ok+0x19> 19: 48 85 c0 test %rax,%rax 1c: 75 05 jne 23 <ok+0x23> 1e: e8 00 00 00 00 callq 23 <ok+0x23> 23: 58 pop %rax 24: c3 retq 25: c3 retq