Compile the following function with options -Os -mthumb -march=armv5te -frename-registers
int foo(int p, int* q) { if (p!=9) *q = 0; else *(q+1) = 0; return 3; } GCC generates: push {lr} cmp r0, #9 // D beq .L2 mov r3, #0 // A str r3, [r1] b .L3 .L2: mov r0, #0 // B str r0, [r1, #4] // C .L3: mov r0, #3 pop {pc} If we replace r0 with r3 in instructions B and C, then A and B will be same. So we can move the same instruction before the instruction D and reduce 1 instruction. Is it a gcse opportunity? -- Summary: GCSE opportunity in if statement 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=40956