public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type
@ 2020-05-12 7:47 gabravier at gmail dot com
2020-05-12 12:02 ` [Bug target/95076] Failure to tail-call on function call of different return type rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: gabravier at gmail dot com @ 2020-05-12 7:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95076
Bug ID: 95076
Summary: Failure to optimize out stack alignment on function
call of different type
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
long long f();
int g()
{
return f();
}
With -O3, LLVM outputs :
g(): # @g()
jmp f() # TAILCALL
GCC outputs :
g():
sub rsp, 8
call f()
add rsp, 8
ret
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/95076] Failure to tail-call on function call of different return type
2020-05-12 7:47 [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type gabravier at gmail dot com
@ 2020-05-12 12:02 ` rguenth at gcc dot gnu.org
2020-05-12 13:13 ` hjl.tools at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-12 12:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95076
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Failure to optimize out |Failure to tail-call on
|stack alignment on function |function call of different
|call of different type on |return type
|x86 |
CC| |hjl.tools at gmail dot com
Target| |x86_64-*-* i?86-*-*
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC doesn't tail-call because the return types are not compatible. With a call
it cannot optimize the stack adjustment because of the ABI.
Note I'm not sure whether the ABI allows %rax to contain "garbage" in the
upper half for a function returning in %eax. So what LLVM does may be wrong.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/95076] Failure to tail-call on function call of different return type
2020-05-12 7:47 [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type gabravier at gmail dot com
2020-05-12 12:02 ` [Bug target/95076] Failure to tail-call on function call of different return type rguenth at gcc dot gnu.org
@ 2020-05-12 13:13 ` hjl.tools at gmail dot com
2020-05-12 13:13 ` hjl.tools at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-12 13:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95076
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Richard Biener from comment #1)
> GCC doesn't tail-call because the return types are not compatible. With a
> call
> it cannot optimize the stack adjustment because of the ABI.
>
> Note I'm not sure whether the ABI allows %rax to contain "garbage" in the
> upper half for a function returning in %eax. So what LLVM does may be wrong.
Don't upper bits of %rax in GCC generate code also contain garbage?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/95076] Failure to tail-call on function call of different return type
2020-05-12 7:47 [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type gabravier at gmail dot com
2020-05-12 12:02 ` [Bug target/95076] Failure to tail-call on function call of different return type rguenth at gcc dot gnu.org
2020-05-12 13:13 ` hjl.tools at gmail dot com
@ 2020-05-12 13:13 ` hjl.tools at gmail dot com
2020-05-12 13:15 ` hjl.tools at gmail dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-12 13:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95076
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-05-12
Target Milestone|--- |11.0
Status|UNCONFIRMED |NEW
CC| |crazylht at gmail dot com
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/95076] Failure to tail-call on function call of different return type
2020-05-12 7:47 [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type gabravier at gmail dot com
` (2 preceding siblings ...)
2020-05-12 13:13 ` hjl.tools at gmail dot com
@ 2020-05-12 13:15 ` hjl.tools at gmail dot com
2020-05-12 13:24 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2020-05-12 13:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95076
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
This ia32 psABI return value discussion also applies here:
https://groups.google.com/forum/#!searchin/ia32-abi/return$20value%7Csort:date/ia32-abi/9H4BBrIdkmk/sjWw06ZPnS4J
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/95076] Failure to tail-call on function call of different return type
2020-05-12 7:47 [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type gabravier at gmail dot com
` (3 preceding siblings ...)
2020-05-12 13:15 ` hjl.tools at gmail dot com
@ 2020-05-12 13:24 ` jakub at gcc dot gnu.org
2021-04-27 11:38 ` jakub at gcc dot gnu.org
2021-07-28 7:04 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-05-12 13:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95076
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yeah, I believe it is safe in this case, but we would need the info whether the
conversion is ok or not already during the tailc pass and on many targets such
a conversion is not ok (e.g. if the target says that the value is zero-extended
into 64-bits or sign-extended, or 32-bit and 64-bit returned in different
register, whatever).
The question is if the existing target hooks are sufficient to query this or if
we need a new target hook.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/95076] Failure to tail-call on function call of different return type
2020-05-12 7:47 [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type gabravier at gmail dot com
` (4 preceding siblings ...)
2020-05-12 13:24 ` jakub at gcc dot gnu.org
@ 2021-04-27 11:38 ` jakub at gcc dot gnu.org
2021-07-28 7:04 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95076
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.0 |11.2
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/95076] Failure to tail-call on function call of different return type
2020-05-12 7:47 [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type gabravier at gmail dot com
` (5 preceding siblings ...)
2021-04-27 11:38 ` jakub at gcc dot gnu.org
@ 2021-07-28 7:04 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28 7:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95076
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.2 |---
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-07-28 7:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 7:47 [Bug target/95076] New: Failure to optimize out stack alignment on function call of different type gabravier at gmail dot com
2020-05-12 12:02 ` [Bug target/95076] Failure to tail-call on function call of different return type rguenth at gcc dot gnu.org
2020-05-12 13:13 ` hjl.tools at gmail dot com
2020-05-12 13:13 ` hjl.tools at gmail dot com
2020-05-12 13:15 ` hjl.tools at gmail dot com
2020-05-12 13:24 ` jakub at gcc dot gnu.org
2021-04-27 11:38 ` jakub at gcc dot gnu.org
2021-07-28 7:04 ` rguenth 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).