https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107102
Bug ID: 107102 Summary: SVE function fails to realize it doesn't need the frame-pointer in the tail call. Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: tnfchris at gcc dot gnu.org Target Milestone: --- Target: aarch64-* The following example: #include <arm_sve.h> void foo(svbool_t p, svbool_t q); void bar() { foo(svptrue_b32(), svptrue_b8()); } generates at -O2 -march=armv8-a+sve2: bar: stp x29, x30, [sp, -16]! ptrue p1.b, all ptrue p0.s, all mov x29, sp bl foo ldp x29, x30, [sp], 16 ret The tail-call gets de-optimized and GCC fails to realize it doesn't need a frame pointer nor the stack pointer at all. In RTL before frame layout there is no stack usage at all however this looks to happen because in the expansion there's a clobber on the LR: (call_insn 7 6 10 2 (parallel [ (call (mem:DI (symbol_ref:DI ("foo") [flags 0x41] <function_decl 0x7fac39ef9e00 foo>) [0 foo S8 A8]) (const_int 0 [0])) (unspec:DI [ (const_int 2 [0x2]) ] UNSPEC_CALLEE_ABI) (clobber (reg:DI 30 x30)) ]) "example.c":6:5 46 {*call_insn} and it, it looks like the expansion missed the sibcall?