public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/21478] New: Improve initialization of sparse local arrays
@ 2005-05-09 22:15 jconner at apple dot com
2005-05-09 22:16 ` [Bug middle-end/21478] " jconner at apple dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: jconner at apple dot com @ 2005-05-09 22:15 UTC (permalink / raw)
To: gcc-bugs
Large local arrays that are initialized to constant values, gcc uses a static template and a call to
memcpy. If these arrays are all or mostly zeroes, if we clear the array using memset and then initialize
the non-zero values inline, it is generally better in two ways:
a) it is faster
b) it requires less program memory overhead to store the array of initializers
Here is an example of source code that gcc could do better on:
void bar (char *);
void foo (void)
{
char bigarray[0x1000] = { 0 };
bar (&bigarray[0]);
}
Which generates a 0x1000 byte constant array of zeroes. Instead, it would be nice if gcc would just
memset the region to zeroes.
This construct is used extensively in the FAAD2 open source AAC encoder/decoder library, resulting in
a 35%+ increase in size.
AFAICT, this applies to all targets, not just ARM.
--
Summary: Improve initialization of sparse local arrays
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jconner at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: powerpc-apple-darwin7.9.0
GCC target triplet: arm-none-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21478
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/21478] Improve initialization of sparse local arrays
2005-05-09 22:15 [Bug middle-end/21478] New: Improve initialization of sparse local arrays jconner at apple dot com
@ 2005-05-09 22:16 ` jconner at apple dot com
2005-05-09 22:30 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jconner at apple dot com @ 2005-05-09 22:16 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21478
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/21478] Improve initialization of sparse local arrays
2005-05-09 22:15 [Bug middle-end/21478] New: Improve initialization of sparse local arrays jconner at apple dot com
2005-05-09 22:16 ` [Bug middle-end/21478] " jconner at apple dot com
@ 2005-05-09 22:30 ` pinskia at gcc dot gnu dot org
2005-05-10 0:50 ` jconner at apple dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-09 22:30 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-09 22:30 -------
Confirmed, if you did " char bigarray[0x1000] = { };" instead it does the correct thing but doing {} is
GNU extension.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
GCC host triplet|powerpc-apple-darwin7.9.0 |
GCC target triplet|arm-none-elf |
Last reconfirmed|0000-00-00 00:00:00 |2005-05-09 22:30:30
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21478
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/21478] Improve initialization of sparse local arrays
2005-05-09 22:15 [Bug middle-end/21478] New: Improve initialization of sparse local arrays jconner at apple dot com
2005-05-09 22:16 ` [Bug middle-end/21478] " jconner at apple dot com
2005-05-09 22:30 ` pinskia at gcc dot gnu dot org
@ 2005-05-10 0:50 ` jconner at apple dot com
2005-05-17 17:25 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jconner at apple dot com @ 2005-05-10 0:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jconner at apple dot com 2005-05-10 00:50 -------
Proposed patch here:
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00773.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21478
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/21478] Improve initialization of sparse local arrays
2005-05-09 22:15 [Bug middle-end/21478] New: Improve initialization of sparse local arrays jconner at apple dot com
` (2 preceding siblings ...)
2005-05-10 0:50 ` jconner at apple dot com
@ 2005-05-17 17:25 ` pinskia at gcc dot gnu dot org
2005-06-01 21:34 ` cvs-commit at gcc dot gnu dot org
2005-06-02 19:17 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-17 17:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-17 17:24 -------
*** Bug 21626 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |etienne_lorrain at yahoo dot
| |fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21478
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/21478] Improve initialization of sparse local arrays
2005-05-09 22:15 [Bug middle-end/21478] New: Improve initialization of sparse local arrays jconner at apple dot com
` (3 preceding siblings ...)
2005-05-17 17:25 ` pinskia at gcc dot gnu dot org
@ 2005-06-01 21:34 ` cvs-commit at gcc dot gnu dot org
2005-06-02 19:17 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-01 21:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-06-01 21:34 -------
Subject: Bug 21478
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: rth@gcc.gnu.org 2005-06-01 21:34:28
Modified files:
gcc : ChangeLog gimplify.c
Log message:
PR 21478
* gimplify.c (gimplify_init_constructor): Don't spill initializer
to read-only memory if it's sparse.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8987&r2=2.8988
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.130&r2=2.131
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21478
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/21478] Improve initialization of sparse local arrays
2005-05-09 22:15 [Bug middle-end/21478] New: Improve initialization of sparse local arrays jconner at apple dot com
` (4 preceding siblings ...)
2005-06-01 21:34 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-02 19:17 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-02 19:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-02 19:17 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21478
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-06-02 19:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-09 22:15 [Bug middle-end/21478] New: Improve initialization of sparse local arrays jconner at apple dot com
2005-05-09 22:16 ` [Bug middle-end/21478] " jconner at apple dot com
2005-05-09 22:30 ` pinskia at gcc dot gnu dot org
2005-05-10 0:50 ` jconner at apple dot com
2005-05-17 17:25 ` pinskia at gcc dot gnu dot org
2005-06-01 21:34 ` cvs-commit at gcc dot gnu dot org
2005-06-02 19:17 ` pinskia at gcc dot gnu dot 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).