public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/99339] Poor codegen with simple varargs Date: Tue, 02 Mar 2021 12:44:29 +0000 [thread overview] Message-ID: <bug-99339-4-7dU1TgzkUs@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99339-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99339 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |missed-optimization Target| |x86_64-*-* Component|c |middle-end CC| |matz at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Status|UNCONFIRMED |NEW Last reconfirmed| |2021-03-02 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- The stack space is not eliminated because we lower __builtin_va_start only after RTL expansion and that reserves stack space necessary for accessing some of the meta (including the passed value itself) as memory. So it's unavoidable up to somebody designing sth smarter around varargs and GIMPLE. Arguably the not lowered variant would be easier to expand optimally: int test_va (int x) { struct va[1]; int i; int _7; <bb 2> [local count: 1073741824]: __builtin_va_start (&va, 0); i_4 = .VA_ARG (&va, 0B, 0B); __builtin_va_end (&va); _7 = i_4 + x_6(D); va ={v} {CLOBBER}; return _7; I'm not fully sure why we lower at all. Part of the lowering determines whether there's any FP arguments referenced and optimizes based on that, but IIRC that's all.
next prev parent reply other threads:[~2021-03-02 12:44 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-02 11:49 [Bug c/99339] New: " redbeard0531 at gmail dot com 2021-03-02 12:44 ` rguenth at gcc dot gnu.org [this message] 2021-03-02 12:46 ` [Bug middle-end/99339] " rguenth at gcc dot gnu.org 2021-03-02 12:53 ` rguenth at gcc dot gnu.org 2021-03-02 13:11 ` jakub at gcc dot gnu.org 2021-03-02 13:28 ` redbeard0531 at gmail dot com 2021-03-02 15:30 ` redbeard0531 at gmail dot com 2021-03-03 7:28 ` rguenth at gcc dot gnu.org 2021-03-03 8:41 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-99339-4-7dU1TgzkUs@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).