From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1562 invoked by alias); 14 Apr 2003 23:46:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 1544 invoked by uid 71); 14 Apr 2003 23:46:00 -0000 Date: Mon, 14 Apr 2003 23:46:00 -0000 Message-ID: <20030414234600.1543.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Andrew Pinski Subject: Re: optimization/9566: Inline function produces much worse code than manual inlining. Reply-To: Andrew Pinski X-SW-Source: 2003-04/txt/msg00654.txt.bz2 List-Id: The following reply was made to PR optimization/9566; it has been noted by GNATS. From: Andrew Pinski To: gcc-gnats@gcc.gnu.org, osv@javad.ru, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org Cc: Andrew Pinski Subject: Re: optimization/9566: Inline function produces much worse code than manual inlining. Date: Mon, 14 Apr 2003 19:35:58 -0400 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- trail&database=gcc&pr=9566 The problem is because inlining causes a temporary variable which causes this and causes it to spill to the stack. struct A { char const* src; char* dest; void copy() { *++dest = *++src; } }; void g1() { A a; for(int i = 0; i < 10; ++i) a.copy(); } void g2() { A a; for(int i = 0; i < 10; ++i) *++a.dest = *++a.src; } void g3() { A a; for(int i = 0; i < 10; ++i) { struct A b = a; { *++b.dest = *++b.src; } a = b; } } Note here g3 and g1 produce the same asm on PPC. Thanks, Andrew Pinski