From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29482 invoked by alias); 19 Oct 2010 00:29:25 -0000 Received: (qmail 29474 invoked by uid 22791); 19 Oct 2010 00:29:25 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID 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; Tue, 19 Oct 2010 00:29:22 +0000 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/46027] (unsignedtype1)(unsignedtype2)(unsignedtype1_var) not changed into unsignedtype1_var & NNN when sizeof(type1) > sizeof(type2) X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: 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 Date: Tue, 19 Oct 2010 00:29:00 -0000 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: 2010-10/txt/msg01551.txt.bz2 Message-ID: <20101019002900.kbdQXfdCnzN-hxPUmBjH0AUOcmJwhNgD8RAe89gTNpY@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46027 --- Comment #2 from Andrew Pinski 2010-10-19 00:29:18 UTC --- Here is a full testcase: typedef unsigned type1; typedef unsigned char type2; type1 t; void f(type1 tt) { type2 t1 = t; type1 t2 = t1; t = t2 & 0xFF; } void f2(type1 tt) { type1 t2 = (type2)t; t = t2 & 0xFF; } void f1(type1 tt) { type1 t2 = t & 0xff; t = t2 & 0xFF; } ---- CUT ---- Currently f does not get optimized after my patch. f1 is optimized before my patch and f2 is optimized afterwards. f requires some kind of forward prop/tree combining to do the work.