From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31213 invoked by alias); 29 Apr 2008 10:02:06 -0000 Received: (qmail 30466 invoked by uid 48); 29 Apr 2008 10:01:23 -0000 Date: Tue, 29 Apr 2008 10:02:00 -0000 Message-ID: <20080429100123.30465.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/14847] [tree-ssa] combine "if (a & 1) goto there" and "if (a & 4) goto there" 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-04/txt/msg02046.txt.bz2 ------- Comment #4 from rguenth at gcc dot gnu dot org 2008-04-29 10:01 ------- The ifcombine pass would do this since 4.3.0 if there were not an extra conversion for a bittest of bit zero: : a.0_2 = (int) a_1(D); D.1556_3 = a.0_2 & 1; if (D.1556_3 != 0) goto (heaven); else goto ; : D.1558_5 = a_1(D) & 4; if (D.1558_5 != 0) goto (heaven); else goto ; this is probably due to fold. I will have a look. For void foo (unsigned int a) { if (a & 2) goto heaven; if (a & 4) goto heaven; return; heaven: bar (); } this is optimized to optimizing bits or bits test to a_1(D) & T != 0 with temporary T = 4 | 2 Merging blocks 2 and 3 foo (unsigned int a) { unsigned int D.1583; unsigned int D.1556; unsigned int D.1555; : D.1555_2 = a_1(D) & 2; D.1556_3 = a_1(D) & 4; D.1583_5 = a_1(D) & 6; if (D.1583_5 != 0) goto (heaven); else goto ; Invalid sum of incoming frequencies 6100, should be 7231 heaven:; bar (); : Invalid sum of incoming frequencies 11131, should be 10000 return; } -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2006-02-05 21:36:17 |2008-04-29 10:01:23 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14847