public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115264] New: RISC-V: yet another instance of poor codegen related to stack (glibc tmpnam.c)
@ 2024-05-28 21:30 vineetg at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: vineetg at gcc dot gnu.org @ 2024-05-28 21:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115264

            Bug ID: 115264
           Summary: RISC-V: yet another instance of poor codegen related
                    to stack (glibc tmpnam.c)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vineetg at gcc dot gnu.org
                CC: jeffreyalaw at gmail dot com, kito.cheng at gmail dot com
  Target Milestone: ---

When working on sum of two s12 optim for function prologue/epilogue noticed
that glibc tempnam.c generates really poor code (as compared to llvm trunk)

--->8-----
typedef long unsigned int size_t;

extern int __gen_tempname (char *__tmpl, int __suffixlen, int __flags, int
__kind);
extern char *__strdup (const char *__string);
extern int __path_search (char *__tmpl, size_t __tmpl_len,
     const char *__dir, const char *__pfx, int __try_tempdir);

char *
tempnam (const char *dir, const char *pfx)
{
  char buf[4096];

  if (__path_search (buf, 4096, dir, pfx, 1))
    return ((void *)0) ;

  if (__gen_tempname (buf, 0, 0, 2))
    return ((void *)0) ;

  return __strdup (buf);
}

--->8-----

- There's two copies of epilogue (for no seemingly obvious benefit)
- s0 is needlessly being spilled (likely one of RA passes generate the refs but
subsequent passes failing to eliminate) - sum of two s12 making it worse.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-28 21:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-28 21:30 [Bug target/115264] New: RISC-V: yet another instance of poor codegen related to stack (glibc tmpnam.c) vineetg 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).