From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8457 invoked by alias); 2 Jul 2009 07:39:32 -0000 Received: (qmail 8400 invoked by uid 48); 2 Jul 2009 07:39:13 -0000 Date: Thu, 02 Jul 2009 07:39:00 -0000 Subject: [Bug target/40615] New: unnecessary CSE X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "carrot at google 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: 2009-07/txt/msg00116.txt.bz2 Compile the attached source code with options -march=armv5te -mthumb -Os -fno-exceptions, gcc generates: push {r4, lr} sub sp, sp, #8 add r4, sp, #4 // redundant mov r0, r4 // add r0, sp, 4 bl _ZN1XC1Ev mov r0, r4 // add r0, sp, 4 bl _Z3barP1X mov r0, r4 // add r0, sp, 4 bl _ZN1XD1Ev add sp, sp, #8 @ sp needed for prologue pop {r4, pc} As mentioned in the comments, the cse is redundant. We can recompute the value of (sp + 4) each time we want it. With this method we can save one instruction. -- Summary: unnecessary CSE Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: carrot at google dot com GCC build triplet: i686-linux GCC host triplet: i686-linux GCC target triplet: arm-eabi http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40615