[Bug rtl-optimization/17234] New: if-conversion bug on x86
dann at godzilla dot ics dot uci dot edu
gcc-bugzilla@gcc.gnu.org
Mon Aug 30 05:26:00 GMT 2004
Compiling
void foo (unsigned *, unsigned *, unsigned);
unsigned *baz (unsigned) __attribute__ ((const));
struct COST
{
unsigned *cost;
unsigned maxWeakConstraintLevel;
};
unsigned * bar(struct COST *c)
{
unsigned *valp;
if(c->maxWeakConstraintLevel == 0)
valp =0;
else
{
valp = baz (4 * 33);
foo (valp, c->cost, c->maxWeakConstraintLevel * sizeof(unsigned));
}
return valp;
}
with -O2 -fomit-frame-pointer on x86 generates:
bar:
subl $28, %esp
movl %edi, 24(%esp)
movl 32(%esp), %edi
movl %esi, 20(%esp)
xorl %esi, %esi <- [1] this should not be here
movl %ebx, 16(%esp)
movl 4(%edi), %ebx
testl %ebx, %ebx
jne .L6
movl %esi, %eax <- it should be before this instruction
movl 16(%esp), %ebx
movl 20(%esp), %esi
movl 24(%esp), %edi
addl $28, %esp
ret
.p2align 4,,7
.L6:
movl $132, (%esp)
call baz
movl %eax, %esi <- %esi is not used on this branch,
so [1] is partially dead code
The instruction [1] is put there by the if-conversion pass, when compiling
with -fno-ifconversion [1] appears only on one branch.
gcc-3.3.3 does not have this problem, so this is a regression.
--
Summary: if-conversion bug on x86
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17234
More information about the Gcc-bugs
mailing list