This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/28685] Multiple comparisons are not simplified
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Oct 2008 20:45:38 -0000
- Subject: [Bug middle-end/28685] Multiple comparisons are not simplified
- References: <bug-28685-1649@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from rguenth at gcc dot gnu dot org 2008-10-12 20:45 -------
Another similar, but yet different case:
int test(int a, int b)
{
int lt = a < b;
int eq = a == b;
if (lt)
return 1;
return eq;
}
this is what we "optimize" it to:
test (int a, int b)
{
int eq;
<bb 2>:
eq_5 = a_2(D) == b_3(D);
if (a_2(D) < b_3(D))
goto <bb 4>;
else
goto <bb 3>;
<bb 3>:
<bb 4>:
# eq_1 = PHI <1(2), eq_5(3)>
return eq_1;
test:
pushl %ebp
movl $1, %eax
movl %esp, %ebp
movl 12(%ebp), %edx
cmpl %edx, 8(%ebp)
jl .L3
sete %al
movzbl %al, %eax
.L3:
popl %ebp
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28685