https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120214
Bug ID: 120214
Summary: REG_RETURNED Does not always work for stack addresses
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: aarch64 arm
Created attachment 61400
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61400&action=edit
testcase
Take the testcase in the attachment.
Compile with -O2 on aarch64 or arm (for some reason RISCV works).
You should get:
```
bl memset
bl doStuff
```
But currently we get:
```
add x0, sp, 16
stp x29, x30, [sp]
.cfi_offset 29, -4128
.cfi_offset 30, -4120
mov x29, sp
bl memset
add x0, sp, 16
bl doStuff
``