public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/36318] New: SRA pessimizes struct copies without -Os
@ 2008-05-23 21:37 astrange at ithinksw dot com
2008-05-23 21:38 ` [Bug tree-optimization/36318] " astrange at ithinksw dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: astrange at ithinksw dot com @ 2008-05-23 21:37 UTC (permalink / raw)
To: gcc-bugs
> /usr/local/gcc44/bin/gcc -v
Using built-in specs.
Target: i386-apple-darwin9.2.2
Configured with: ../gcc/configure --prefix=/usr/local/gcc44
--enable-threads=posix --with-arch=core2 --with-tune=core2 --with-gmp=/sw
--with-mpfr=/sw --disable-nls --disable-bootstrap --enable-checking=yes,rtl
--enable-languages=c,c++,objc
Thread model: posix
gcc version 4.4.0 20080523 (experimental) (GCC)
and these options:
> gcc -fno-pic -fomit-frame-pointer -O3 -S wc.c
For the attached source, gcc generates good code for global variable
assignment:
_foo0:
subl $12, %esp
movl _b, %eax
movl %eax, _a
addl $12, %esp
ret
but uses byte copies for pointer assignment:
_foo1:
subl $12, %esp
movl %ebx, 4(%esp)
movl %esi, 8(%esp)
movl 20(%esp), %eax
movl 16(%esp), %edx
movzbl (%eax), %esi
movzbl 1(%eax), %ebx
movzbl 2(%eax), %ecx
movzbl 3(%eax), %eax
movb %cl, 2(%edx)
movb %al, 3(%edx)
movb %bl, 1(%edx)
movl %esi, %eax
movb %al, (%edx)
movl 4(%esp), %ebx
movl 8(%esp), %esi
addl $12, %esp
ret
Using either -Os or -fno-tree-sra fixes it.
--
Summary: SRA pessimizes struct copies without -Os
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: astrange at ithinksw dot com
GCC target triplet: i?86-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36318
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/36318] SRA pessimizes struct copies without -Os
2008-05-23 21:37 [Bug tree-optimization/36318] New: SRA pessimizes struct copies without -Os astrange at ithinksw dot com
@ 2008-05-23 21:38 ` astrange at ithinksw dot com
2009-05-30 0:19 ` astrange at ithinksw dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: astrange at ithinksw dot com @ 2008-05-23 21:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from astrange at ithinksw dot com 2008-05-23 21:37 -------
Created an attachment (id=15678)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15678&action=view)
testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36318
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/36318] SRA pessimizes struct copies without -Os
2008-05-23 21:37 [Bug tree-optimization/36318] New: SRA pessimizes struct copies without -Os astrange at ithinksw dot com
2008-05-23 21:38 ` [Bug tree-optimization/36318] " astrange at ithinksw dot com
@ 2009-05-30 0:19 ` astrange at ithinksw dot com
2009-05-30 9:50 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: astrange at ithinksw dot com @ 2009-05-30 0:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from astrange at ithinksw dot com 2009-05-30 00:19 -------
Fixed with new SRA:
_foo1:
subl $12, %esp
movl 20(%esp), %eax
movl (%eax), %edx
movl 16(%esp), %eax
movl %edx, (%eax)
addl $12, %esp
ret
--
astrange at ithinksw dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36318
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/36318] SRA pessimizes struct copies without -Os
2008-05-23 21:37 [Bug tree-optimization/36318] New: SRA pessimizes struct copies without -Os astrange at ithinksw dot com
2008-05-23 21:38 ` [Bug tree-optimization/36318] " astrange at ithinksw dot com
2009-05-30 0:19 ` astrange at ithinksw dot com
@ 2009-05-30 9:50 ` rguenth at gcc dot gnu dot org
2009-06-05 4:31 ` astrange at ithinksw dot com
2009-06-05 8:30 ` rguenth at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-30 9:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2009-05-30 09:49 -------
Can you provide a testcase suitable for inclusion in the testsuite?
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36318
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/36318] SRA pessimizes struct copies without -Os
2008-05-23 21:37 [Bug tree-optimization/36318] New: SRA pessimizes struct copies without -Os astrange at ithinksw dot com
` (2 preceding siblings ...)
2009-05-30 9:50 ` rguenth at gcc dot gnu dot org
@ 2009-06-05 4:31 ` astrange at ithinksw dot com
2009-06-05 8:30 ` rguenth at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: astrange at ithinksw dot com @ 2009-06-05 4:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from astrange at ithinksw dot com 2009-06-05 04:31 -------
This bug must have been weaker than I remembered it; when I used 4 char fields
instead of one char[4], 4.4 behaved properly too.
How about:
Alexander Strange <astrange@ithinksw.com
PR tree-optimization/36318
* gcc.dg/tree-ssa/sra-7.c: New test.
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-sra-details" } */
typedef struct {char f[4];} __attribute__((aligned (4))) s;
void a(s *s1, s *s2)
{
*s1 = *s2;
}
/* Struct copies should not be split into members */
/* { dg-final { scan-tree-dump "= \\\*s2" "sra"} } */
/* { dg-final { cleanup-tree-dump "sra" } } */
I checked sra instead of esra since it runs last and this is a negative test.
Hopefully this is trivial?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36318
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/36318] SRA pessimizes struct copies without -Os
2008-05-23 21:37 [Bug tree-optimization/36318] New: SRA pessimizes struct copies without -Os astrange at ithinksw dot com
` (3 preceding siblings ...)
2009-06-05 4:31 ` astrange at ithinksw dot com
@ 2009-06-05 8:30 ` rguenth at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-05 8:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from rguenth at gcc dot gnu dot org 2009-06-05 08:30 -------
Subject: Bug 36318
Author: rguenth
Date: Fri Jun 5 08:30:21 2009
New Revision: 148203
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=148203
Log:
2009-06-05 Alexander Strange <astrange@ithinksw.com>
PR tree-optimization/36318
* gcc.dg/tree-ssa/sra-7.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/sra-7.c
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36318
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-06-05 8:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-23 21:37 [Bug tree-optimization/36318] New: SRA pessimizes struct copies without -Os astrange at ithinksw dot com
2008-05-23 21:38 ` [Bug tree-optimization/36318] " astrange at ithinksw dot com
2009-05-30 0:19 ` astrange at ithinksw dot com
2009-05-30 9:50 ` rguenth at gcc dot gnu dot org
2009-06-05 4:31 ` astrange at ithinksw dot com
2009-06-05 8:30 ` rguenth 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).