https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114688
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-04-11 Keywords| |missed-optimization, ra Ever confirmed|0 |1 Target| |x86_64-*-* Status|UNCONFIRMED |NEW --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- char g; int v; static inline __attribute__((always_inline)) void foo(char p_17); void func_1() { foo(g); } static inline void foo(char c) { v = (char)(2 - c) & c; } shows that with -Os we get func_1: .LFB0: .cfi_startproc movb g(%rip), %dl movb $2, %al subl %edx, %eax andl %edx, %eax movsbl %al, %eax movl %eax, v(%rip) ret I think we have duplicate bugs that show we're too happy replicating memory operands to multiple instructions. That might be a target cost thing in the end.