https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115043
Bug ID: 115043 Summary: aarch64 locally_streaming function appears to have CFA note on wrong instruction in prologue Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: matmal01 at gcc dot gnu.org Target Milestone: --- Apologies if I'm misunderstanding something here -- but I noticed this RTL sequence and I believe the `REG_CFA_DEF_CFA` note is on the wrong insn. I have not observed wrong behaviour coming from this, but figured still worth a bug report in case it is indeed wrong. There seem to be a pair of instructions, one doing some special SME operation and another storing the stack pointer into x11. The instruction doing the special SME thing has a note saying that it sets the CFA to x11. I would have expected the note to be on the insn after that records SP into x11. vshcmd: > cat basic-streaming.c [[arm::locally_streaming]] void no_gprs_saved (__SVBool_t x) { asm (""); } gnu-work [13:19:27] $ vshcmd: > ${install_dir}/aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc \ vshcmd: > basic-streaming.c \ vshcmd: > -fdiagnostics-plain-output -march=armv8.2-a+sme+sve -fno-stack-protector \ vshcmd: > -fdump-rtl-all-all \ vshcmd: > -O -fshrink-wrap -fstack-clash-protection -g -S -o /dev/null > > > > gnu-work [13:19:36] $ > > > > > > > > > > > > > > > > vshcmd: > # I'm surprised that the REG_CFA_DEF_CFA note is on the instruction vshcmd: > # just before we move the stack pointer into x11. vshcmd: > grep -C 4 REG_CFA_DEF_CFA.*x11 basic-streaming.c.*.late_pro_and_epilogue (insn/f 15 14 16 2 (set (reg:DI 13 x13) (const:DI (unspec:DI [ (const_int 288 [0x120]) ] UNSPEC_SME_VQ))) "basic-streaming.c":3:1 -1 (expr_list:REG_CFA_DEF_CFA (reg:DI 11 x11) (nil))) (insn 16 15 17 2 (set (reg:DI 11 x11) (reg/f:DI 31 sp)) "basic-streaming.c":3:1 -1 (nil)) gnu-work [13:21:21] $