[Bug target/44474] GCC inserts redundant "test" instruction due to incorrect clobber
astrange at ithinksw dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 1 03:43:00 GMT 2010
------- Comment #1 from astrange at ithinksw dot com 2010-07-01 03:43 -------
The problem is combine.
This:
int test2( int *b )
{
int b_ = *b;
b_--;
if( b_ == 0 ) {
*b = b_;
return foo();
}
*b = b_;
return 0;
}
works:
_test2:
LFB1:
movl (%rdi), %eax
decl %eax
je L7 <- uses decl
movl %eax, (%rdi)
xorl %eax, %eax
ret
.align 4,0x90
L7:
movl $0, (%rdi)
xorl %eax, %eax
jmp _foo
The original turns (*b)-- into load/dec/store/cmp - combine tries to combine
dec/store which fails, but doesn't try dec/cmp.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44474
More information about the Gcc-bugs
mailing list