From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9619 invoked by alias); 12 Oct 2008 20:46:58 -0000 Received: (qmail 9543 invoked by uid 48); 12 Oct 2008 20:45:38 -0000 Date: Sun, 12 Oct 2008 20:46:00 -0000 Message-ID: <20081012204538.9542.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/28685] Multiple comparisons are not simplified In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-10/txt/msg00809.txt.bz2 ------- 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; : eq_5 = a_2(D) == b_3(D); if (a_2(D) < b_3(D)) goto ; else goto ; : : # 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