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