From patchwork Tue Jul 26 17:22:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 106896 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 B753DB6F7F for ; Wed, 27 Jul 2011 03:23:07 +1000 (EST) Received: (qmail 31398 invoked by alias); 26 Jul 2011 17:23:05 -0000 Received: (qmail 31390 invoked by uid 22791); 26 Jul 2011 17:23:04 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jul 2011 17:22:51 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id E64088EE65; Tue, 26 Jul 2011 19:22:49 +0200 (CEST) Date: Tue, 26 Jul 2011 19:22:49 +0200 From: Martin Jambor To: GCC Patches Cc: Ulrich Weigand Subject: Re: [PATCH, PR 49094] Refrain from creating misaligned accesses in SRA Message-ID: <20110726172249.GB20101@virgil.arch.suse.de> Mail-Followup-To: GCC Patches , Ulrich Weigand References: <201107201811.p6KIB6jS009963@d06av02.portsmouth.uk.ibm.com> <20110721094032.GA30670@virgil.arch.suse.de> <20110725175259.GC17163@virgil.arch.suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 On Tue, Jul 26, 2011 at 09:39:02AM +0200, Richard Guenther wrote: > On Mon, Jul 25, 2011 at 7:52 PM, Martin Jambor wrote: ... > > > > 2011-07-25  Martin Jambor   > > > >        * tree-sra.c (tree_non_mode_aligned_mem_p): Strip conversions and > >        return false for invariants. > > > > Index: src/gcc/tree-sra.c > > =================================================================== > > --- src.orig/gcc/tree-sra.c > > +++ src/gcc/tree-sra.c > > @@ -1075,9 +1075,14 @@ tree_non_mode_aligned_mem_p (tree exp) > >   enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp)); > >   unsigned int align; > > > > +  while (CONVERT_EXPR_P (exp) > > There can be no convert exprs here, and there can be at most one > VIEW_CONVERT_EXPR. > > > +        || TREE_CODE (exp) == VIEW_CONVERT_EXPR) > > +    exp = TREE_OPERAND (exp, 0); > > + > >   if (TREE_CODE (exp) == SSA_NAME > >       || TREE_CODE (exp) == MEM_REF > >       || mode == BLKmode > > +      || is_gimple_min_invariant (exp) > >       || !STRICT_ALIGNMENT) > >     return false; > > Otherwise ok. > OK, this is what I have just committed as revision 176797 after re-testing. Thanks, Martin 2011-07-26 Martin Jambor * tree-sra.c (tree_non_mode_aligned_mem_p): Strip conversions and return false for invariants. Index: src/gcc/tree-sra.c =================================================================== --- src.orig/gcc/tree-sra.c +++ src/gcc/tree-sra.c @@ -1075,9 +1075,13 @@ tree_non_mode_aligned_mem_p (tree exp) enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp)); unsigned int align; + if (TREE_CODE (exp) == VIEW_CONVERT_EXPR) + exp = TREE_OPERAND (exp, 0); + if (TREE_CODE (exp) == SSA_NAME || TREE_CODE (exp) == MEM_REF || mode == BLKmode + || is_gimple_min_invariant (exp) || !STRICT_ALIGNMENT) return false;