[Bug target/40956] New: GCSE opportunity in if statement
carrot at google dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 3 22:55:00 GMT 2009
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
More information about the Gcc-bugs
mailing list