From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29056 invoked by alias); 14 Mar 2012 09:39:53 -0000 Received: (qmail 29030 invoked by uid 22791); 14 Mar 2012 09:39:52 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_TM X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Mar 2012 09:39:32 +0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/52134] Does not fold (x * 4) & -4 Date: Wed, 14 Mar 2012 09:40:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: missed-optimization, TREE X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-03/txt/msg01242.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52134 --- Comment #8 from rguenther at suse dot de 2012-03-14 09:39:31 UTC --- On Tue, 13 Mar 2012, pinskia at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52134 > > --- Comment #6 from Andrew Pinski 2012-03-13 22:08:12 UTC --- > CCP could also remove the &: > Visiting statement: > D.1713_2 = t_1(D) * 4; > which is likely CONSTANT > Lattice value changed to CONSTANT Lattice value changed to CONSTANT > 0x00000000000000000 (0x000000000fffffffc). Adding SSA edges to worklist. > > Visiting statement: > D.1712_3 = D.1713_2 & 4294967292; > which is likely CONSTANT > Lattice value changed to CONSTANT Lattice value changed to CONSTANT > 0x00000000000000000 (0x000000000fffffffc). Adding SSA edges to worklist. > > .. > Visiting statement: > D.1710_2 = t_1(D) * 4; > which is likely CONSTANT > Lattice value changed to CONSTANT Lattice value changed to CONSTANT > 0x00000000000000000 (0xfffffffffffffffffffffffffffffffc). Adding SSA edges to > worklist. > > Visiting statement: > D.1709_3 = D.1710_2 & -4; > which is likely CONSTANT > Lattice value changed to CONSTANT Lattice value changed to CONSTANT > 0x00000000000000000 (0xfffffffffffffffffffffffffffffffc). Adding SSA edges to > worklist. > > > See how the lattice's already have its last 3 bits unset. In fact I think we > should only do this in the ccp/vrp passes to remove the & rather than fold. Yeah, CCP and VRP can do this as well. In fact folding bit-operations with the bit-CCP lattice is an obvious improvement, best done in ccp_fold_stmt which is called at lattice substitution time. Richard.