public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/107102] New: SVE function fails to realize it doesn't need the frame-pointer in the tail call.
@ 2022-09-30 16:37 tnfchris at gcc dot gnu.org
2022-10-04 16:03 ` [Bug target/107102] " ktkachov at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2022-09-30 16:37 UTC (permalink / raw)
To: gcc-bugs
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?
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/107102] SVE function fails to realize it doesn't need the frame-pointer in the tail call.
2022-09-30 16:37 [Bug target/107102] New: SVE function fails to realize it doesn't need the frame-pointer in the tail call tnfchris at gcc dot gnu.org
@ 2022-10-04 16:03 ` ktkachov at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2022-10-04 16:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107102
ktkachov at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ktkachov at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-10-04
--- Comment #1 from ktkachov at gcc dot gnu.org ---
Confirmed, clang tail-calls this:
bar: // @bar
ptrue p1.b
ptrue p0.s
and p0.b, p1/z, p1.b, p0.b
b foo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-04 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 16:37 [Bug target/107102] New: SVE function fails to realize it doesn't need the frame-pointer in the tail call tnfchris at gcc dot gnu.org
2022-10-04 16:03 ` [Bug target/107102] " ktkachov 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).