public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/104372] New: [ARM] Unnecessary writes to stack when passing aggregate in registers
@ 2022-02-03 19:20 palchak at google dot com
2022-02-03 19:21 ` [Bug rtl-optimization/104372] " palchak at google dot com
2022-02-04 0:50 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: palchak at google dot com @ 2022-02-03 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104372
Bug ID: 104372
Summary: [ARM] Unnecessary writes to stack when passing
aggregate in registers
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: palchak at google dot com
Target Milestone: ---
Missed optimization when an aggregate is passed by value entirely in registers:
struct Bar {};
struct Foo {
Bar *addr;
int size;
};
Bar* MakeBar1(Bar *addr, int) noexcept {
return addr;
}
Bar* MakeBar2(Foo foo) noexcept {
return foo.addr;
}
When compiled with '-O2' using 'arm-unknown-linux-gnueabihf-g++ (GCC) 12.0.0'
generates:
MakeBar1(Bar*, int):
bx lr
MakeBar2(Foo):
sub sp, sp, #8
add r3, sp, #8
stmdb r3, {r0, r1}
add sp, sp, #8
bx lr
The creation of a stack frame in MakeBar2 is completely unnecessary. For
comparison, Clang 11.0.1 generates identical code for both functions that
matches MakeBar1 shown here.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/104372] [ARM] Unnecessary writes to stack when passing aggregate in registers
2022-02-03 19:20 [Bug rtl-optimization/104372] New: [ARM] Unnecessary writes to stack when passing aggregate in registers palchak at google dot com
@ 2022-02-03 19:21 ` palchak at google dot com
2022-02-04 0:50 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: palchak at google dot com @ 2022-02-03 19:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104372
--- Comment #1 from David Palchak <palchak at google dot com> ---
Demo here:
https://godbolt.org/z/Tbh5YP61h
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/104372] [ARM] Unnecessary writes to stack when passing aggregate in registers
2022-02-03 19:20 [Bug rtl-optimization/104372] New: [ARM] Unnecessary writes to stack when passing aggregate in registers palchak at google dot com
2022-02-03 19:21 ` [Bug rtl-optimization/104372] " palchak at google dot com
@ 2022-02-04 0:50 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-04 0:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104372
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 50883.
*** This bug has been marked as a duplicate of bug 50883 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-04 0:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 19:20 [Bug rtl-optimization/104372] New: [ARM] Unnecessary writes to stack when passing aggregate in registers palchak at google dot com
2022-02-03 19:21 ` [Bug rtl-optimization/104372] " palchak at google dot com
2022-02-04 0:50 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).