From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22199 invoked by alias); 23 May 2008 21:37:21 -0000 Received: (qmail 20794 invoked by uid 48); 23 May 2008 21:36:39 -0000 Date: Fri, 23 May 2008 21:37:00 -0000 Subject: [Bug tree-optimization/36318] New: SRA pessimizes struct copies without -Os X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "astrange at ithinksw dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-05/txt/msg01815.txt.bz2 > /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