From patchwork Wed Feb 16 10:04:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 83351 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 2B01EB710C for ; Wed, 16 Feb 2011 21:04:45 +1100 (EST) Received: (qmail 5608 invoked by alias); 16 Feb 2011 10:04:40 -0000 Received: (qmail 5598 invoked by uid 22791); 16 Feb 2011 10:04:39 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Feb 2011 10:04:30 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1GA4QVA024947 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Feb 2011 05:04:26 -0500 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1GA4Odg008292 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 Feb 2011 05:04:25 -0500 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id p1GA4LlH018593 for ; Wed, 16 Feb 2011 08:04:21 -0200 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p1GA4JGQ032454; Wed, 16 Feb 2011 08:04:19 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id p1GA4AAw032452; Wed, 16 Feb 2011 08:04:10 -0200 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: [PR tree-optimization/46620, 4.4] skip padding in bitfield SRA grouping Date: Wed, 16 Feb 2011 08:04:00 -0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Before the latest SRA rewrite, we had a pass that attempted to group multiple bitfields into single variables. It attempted to extend these variables to cover padding bits, but there was a bug that got it confused when it found padding bits before the range it intended to cover. This patch changes the tests so that the tentatively-extended range will always shrink towards the range of interest, instead of getting stuck at a padding range. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog from Alexandre Oliva PR tree-optimization/46620 * tree-sra.c (try_instantiate_multiple_fields): Don't get stuck at padding within accessed words. Index: gcc/tree-sra.c =================================================================== --- gcc/tree-sra.c.orig 2011-02-15 22:32:20.659134294 -0200 +++ gcc/tree-sra.c 2011-02-15 22:37:41.632435631 -0200 @@ -1661,13 +1661,13 @@ try_instantiate_multiple_fields (struct || mbit + msize <= fbit) continue; - if (fbit <= mbit) + if (fbit < bit) { unsigned HOST_WIDE_INT diff = fbit + fsize - mbit; mbit += diff; msize -= diff; } - else if (fbit > mbit) + else if (fbit > bit) msize -= (mbit + msize - fbit); else gcc_unreachable ();