From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22643 invoked by alias); 27 Oct 2011 16:53:39 -0000 Received: (qmail 22632 invoked by uid 22791); 27 Oct 2011 16:53:37 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 16:53:24 +0000 From: "rearnsha at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/50883] [ARM] Suboptimal optimization for small structures Date: Thu, 27 Oct 2011 16:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rearnsha at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2011-10/txt/msg02892.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50883 Richard Earnshaw changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW CC| |rearnsha at gcc dot gnu.org --- Comment #6 from Richard Earnshaw 2011-10-27 16:53:07 UTC --- So for PPC, this seems to be a lucky side-effect of the way the PPC ABI is defined. On PPC the argument is passed by reference and the compiler generates an initial load expression of X from memory (a callee copy). The RTL optimization passes are then (in combination with the subreg splitting code) able to notice, somehow, that this is equivalent to the final result and to make use of it. On ARM the structure is passed by value and the argument expanding code immediately tries to store a copy into the stack. Then, rather than seeing that this could be used from a register value it tries to work solely with the stack copy. I notice that neither architecture optimizes this if the struct is passed as an address rather than by value.