From patchwork Mon Feb 27 15:35:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 143210 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 9C0B4B6FB9 for ; Tue, 28 Feb 2012 02:36:07 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1330961767; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=0gExTog YgrzMTmgDSWEvY0M1OlI=; b=aTwT3dtNq927NoGMP9NFL+r5xJZ4LROPIv2i59T 3igwFVHJ6onqvThoX4lkEEMego7vb+v//RRaYDtEl5uWYNIdSla6joSzROikoQp4 DVRFpPIXhKThvhDQlcdI0pJ/P8y2/MyuD7+kPp5gOY0j5qJk0Yemcs/wtFIjocHf k4VI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=V0oEriom643+m7JOmB8xjtjrIpN33BTD2Su5YbfVNKl1Oe6NBdPAMklM4GewdT DClBBXmg/fJhjlulRZtdeDt12ybJNVZSqtShq3yjZRDnQWOpF62EgcwJ9IOJPY0A Kuf5EvjSUYDtJliXZfkLhMCpYyCi1zgShg4m8VOxktpbQ=; Received: (qmail 3604 invoked by alias); 27 Feb 2012 15:36:03 -0000 Received: (qmail 3503 invoked by uid 22791); 27 Feb 2012 15:36:02 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD 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; Mon, 27 Feb 2012 15:35:49 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 66E7D8FD0F for ; Mon, 27 Feb 2012 16:35:48 +0100 (CET) Date: Mon, 27 Feb 2012 16:35:48 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Cc: Martin Jambor Subject: [PATCH] Fix PR52395 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) 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 This makes the patch for PR50444 less conservative by also looking at TYPE_ALIGN of the base we offset. I guess we do not need to worry about the '???' as IPA SRA uses sth different (see PR52402) and the only case I definitely see only creates an address of the generated access. Bootstrapped and tested on x86_64-unknown-linux-gnu. I'm leaving this one for comments until tomorrow. Richard. 2012-02-27 Richard Guenther PR tree-optimization/52395 * tree-sra.c (build_ref_for_offset): Also look at the base TYPE_ALIGN when figuring out the alignment of the replacement. Index: gcc/tree-sra.c =================================================================== --- gcc/tree-sra.c (revision 184591) +++ gcc/tree-sra.c (working copy) @@ -1526,10 +1526,12 @@ build_ref_for_offset (location_t loc, tr we can extract more optimistic alignment information by looking at the access mode. That would constrain the alignment of base + base_offset which we would need to - adjust according to offset. - ??? But it is not at all clear that prev_base is an access - that was in the IL that way, so be conservative for now. */ + adjust according to offset. */ align = get_pointer_alignment_1 (base, &misalign); + if (misalign == 0 + && (TREE_CODE (prev_base) == MEM_REF + || TREE_CODE (prev_base) == TARGET_MEM_REF)) + align = MAX (align, TYPE_ALIGN (TREE_TYPE (prev_base))); misalign += (double_int_sext (tree_to_double_int (off), TYPE_PRECISION (TREE_TYPE (off))).low * BITS_PER_UNIT);