From patchwork Fri Feb 3 11:19:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 139354 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 56963B71AE for ; Fri, 3 Feb 2012 22:19:30 +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=1328872771; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To: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=TP9JMH+/Wm8Ucei39WnN gWbyzlc=; b=PXK6/D3nFz2O/YENKR2+Wx6zMGg4+QoGzwkg5y+22/Q9ePA/9ojN sUF86epVFZ4UbZroNw97BYoRy3izVEBso6m+0yww+Yf7DQv7jDjqyJODfHM4Wdl1 sz6kAcwA3L5F8QG/lYNDnDIfMEcD/0ncSdnOmWwnteNid6NjhHgEA8s= 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: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=ppI8oLb3dUvoxZvofVIcUQCkF4SvAwIBqKbaQpalJzc5erliyGHVoNZoGatM/N nXW3DAzFazHWwH9cJluAoxi2DXwzB8JvuUVklK5K1QhxlXEgSnrVGSAXWXaRwqUd qILz4kE+NrgidL/UOEScI/17SDVmNXvfa9zi//meN8gwY=; Received: (qmail 11120 invoked by alias); 3 Feb 2012 11:19:26 -0000 Received: (qmail 11044 invoked by uid 22791); 3 Feb 2012 11:19:25 -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; Fri, 03 Feb 2012 11:19:10 +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 916A78BB22 for ; Fri, 3 Feb 2012 12:19:09 +0100 (CET) Date: Fri, 3 Feb 2012 12:19:09 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix SRA access replacement renaming 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 If we have something like BIT_FIELD_REF = D.1722_3; where a.D.1707 is of integer type then SRA will happily create an SSA name replacement for a.D1707 resulting in invalid GIMPLE IL with partial updates to SSA names (and crash later in the verifiers). The following patch cures this - I have not been able to come up with a testcase with an unpatched trunk though. Bootstrap & regtest pending on x86_64-unknown-linux-gnu. Richard. 2012-02-03 Richard Guenther * tree-sra.c (create_access_replacement): Only rename the replacement if we can rewrite it into SSA form. Properly mark register typed replacements that we cannot rewrite with TREE_ADDRESSABLE. Index: gcc/tree-sra.c =================================================================== --- gcc/tree-sra.c (revision 183867) +++ gcc/tree-sra.c (working copy) @@ -1908,13 +1908,19 @@ create_access_replacement (struct access repl = create_tmp_var (access->type, "SR"); add_referenced_var (repl); - if (rename) + if (!access->grp_partial_lhs + && rename) mark_sym_for_renaming (repl); - if (!access->grp_partial_lhs - && (TREE_CODE (access->type) == COMPLEX_TYPE - || TREE_CODE (access->type) == VECTOR_TYPE)) - DECL_GIMPLE_REG_P (repl) = 1; + if (TREE_CODE (access->type) == COMPLEX_TYPE + || TREE_CODE (access->type) == VECTOR_TYPE) + { + if (!access->grp_partial_lhs) + DECL_GIMPLE_REG_P (repl) = 1; + } + else if (access->grp_partial_lhs + && is_gimple_reg_type (access->type)) + TREE_ADDRESSABLE (repl) = 1; DECL_SOURCE_LOCATION (repl) = DECL_SOURCE_LOCATION (access->base); DECL_ARTIFICIAL (repl) = 1;