From: Magnus Fromreide <magfr@lysator.liu.se>
To: gcc-help@gcc.gnu.org
Subject: Optimizing
Date: Sun, 30 Jan 2011 20:18:00 -0000 [thread overview]
Message-ID: <1296416236.32435.15.camel@sara> (raw)
Consider the following code:
----
#define SRC "Big blob of text goes here"
extern int foo(int, const void*, int);
void f1(void) {
foo(1, SRC, sizeof(SRC) - 1);
}
void f2(void) {
char buf[sizeof(SRC) - 1];
__builtin_memcpy(buf, SRC, sizeof(SRC) - 1);
foo(1, buf, sizeof(SRC) - 1);
}
----
Is it a valid optimization for the compiler to generate the same
instructions for f2 as it generates for f1?
Would it be hard to make GCC do it?
/MF
next reply other threads:[~2011-01-30 19:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-30 20:18 Magnus Fromreide [this message]
2011-01-30 20:24 ` Optimizing Kalle Olavi Niemitalo
2011-01-30 20:55 ` Optimizing Enrico Weigelt
2011-01-30 21:02 ` Optimizing Jonathan Wakely
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=1296416236.32435.15.camel@sara \
--to=magfr@lysator.liu.se \
--cc=gcc-help@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: link
Be 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).