From patchwork Mon May 7 12:56: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: 157304 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 B08B8B6FA8 for ; Mon, 7 May 2012 22:57:10 +1000 (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=1337000232; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=GDRhJVwxS6pweoNbCkrX 2AKlCLY=; b=fnUOy17b8Es71czAiACEeXlqlDw8X8CIhVh/8Tss/FeDd7jgt4rR emmRxt0zfdVU58+a2N4Q4zeKIFK8Qty6D/YS0GzAXEOEFyK3PiHU4PC24hAW5uch VC6FJ5Lh7D0sa4iRc0uWUGdpLzTHg7H1p737lCHQMkAwdyWAYS7SGKs= 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:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=kPvVjnI/2NVZPX4QVHnuEtklBh72TdcX+YC4j2ECmrL7KBgBRWMWi1YvPSbvcl W+Nzzfh4+EB7wyKfEmtsJraOU+5BRBCzFfwiqv1GRSsfzo1zntbfjsLLfWb1nGwV XL4Mrwl1fQrfpo23SLqo+I0x3i4J8EzJdAcn2H2fY3wBo=; Received: (qmail 3919 invoked by alias); 7 May 2012 12:57:04 -0000 Received: (qmail 3908 invoked by uid 22791); 7 May 2012 12:57:02 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, 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, 07 May 2012 12:56: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 A39AD90349 for ; Mon, 7 May 2012 14:56:48 +0200 (CEST) Date: Mon, 7 May 2012 14:56:48 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR53195, properly add referenced vars during IPA-CP Message-ID: 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 We fail to add referenced vars when inline copies are instantiated from clones created from IPA-CP. That later leads to ICEs in remove-unused-locals because var_ann has not been allocated. Bootstrapped and tested on x86_64-unknown-linux-gnu, LTO bootstrapped. Applied to trunk and branch. Richard. 2012-05-07 Richard Guenther PR tree-optimization/53195 * tree-inline.c (setup_one_parameter): Properly add referenced vars from the parameters new known value. Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c (revision 187228) +++ gcc/tree-inline.c (working copy) @@ -2607,6 +2607,17 @@ setup_one_parameter (copy_body_data *id, /* Make gimplifier happy about this variable. */ DECL_SEEN_IN_BIND_EXPR_P (var) = 1; + /* We are eventually using the value - make sure all variables + referenced therein are properly recorded. */ + if (value + && gimple_in_ssa_p (cfun) + && TREE_CODE (value) == ADDR_EXPR) + { + tree base = get_base_address (TREE_OPERAND (value, 0)); + if (base && TREE_CODE (base) == VAR_DECL) + add_referenced_var (base); + } + /* If the parameter is never assigned to, has no SSA_NAMEs created, we would not need to create a new variable here at all, if it weren't for debug info. Still, we can just use the argument