From patchwork Tue Sep 20 10:26:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 115476 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 8E8F21007D1 for ; Tue, 20 Sep 2011 20:27:07 +1000 (EST) Received: (qmail 29430 invoked by alias); 20 Sep 2011 10:27:06 -0000 Received: (qmail 29419 invoked by uid 22791); 20 Sep 2011 10:27:04 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_TM X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Sep 2011 10:26:47 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id C11C59AC789; Tue, 20 Sep 2011 12:26:45 +0200 (CEST) Date: Tue, 20 Sep 2011 12:26:45 +0200 From: Jan Hubicka To: Eric Botcazou Cc: Jan Hubicka , gcc-patches@gcc.gnu.org, mjambor@suse.cz Subject: Re: inline-analysis improvement Message-ID: <20110920102645.GA21804@kam.mff.cuni.cz> References: <20110915102759.GG13389@kam.mff.cuni.cz> <201109161641.10951.ebotcazou@adacore.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201109161641.10951.ebotcazou@adacore.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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 > > * ipa-inline-analysis.c (add_condition): Add conditions parameter; > > simplify obviously true clauses. > > (and_predicates, or_predicates): Add conditions parameter. > > (inline_duplication_hoook): Update. > > (mark_modified): New function. > > (unmodified_parm): New function. > > (eliminated_by_inlining_prob, (set_cond_stmt_execution_predicate, > > set_switch_stmt_execution_predicate, will_be_nonconstant_predicate): > > Use unmodified_parm. > > (estimate_function_body_sizes): Update. > > (remap_predicate): Update. > > This breaks things in Ada: > > Program received signal SIGSEGV, Segmentation fault. > walk_aliased_vdefs_1 (ref=0xffffcbf4, vdef=0x0, > walker=0x873e3e0 , data=0xffffcc1f, visited=0xffffcbc0, > cnt=0) at /home/eric/svn/gcc/gcc/tree-ssa-alias.c:1996 > 1996 gimple def_stmt = SSA_NAME_DEF_STMT (vdef); > (gdb) bt > #0 walk_aliased_vdefs_1 (ref=0xffffcbf4, vdef=0x0, > walker=0x873e3e0 , data=0xffffcc1f, visited=0xffffcbc0, > cnt=0) at /home/eric/svn/gcc/gcc/tree-ssa-alias.c:1996 > #1 0x089c3a6d in walk_aliased_vdefs (ref=0xffffcbf4, vdef=0x0, > walker=0x873e3e0 , data=0xffffcc1f, visited=0xffffcbc0) > at /home/eric/svn/gcc/gcc/tree-ssa-alias.c:2037 > #2 0x087456b5 in unmodified_parm (stmt=0xf7cf6ab0, op=0xf7cf77e0) > at /home/eric/svn/gcc/gcc/ipa-inline-analysis.c:1104 > #3 0x08748a99 in eliminated_by_inlining_prob (stmt=) > at /home/eric/svn/gcc/gcc/ipa-inline-analysis.c:1165 Hi, the problem here is that we consider ¶m.foo to be a memory reference, while it is not. The following patch should fix it, but because it changes the behaviour of inline heuristics, I will run bechmarks tonight before committing it. Index: ipa-inline-analysis.c =================================================================== --- ipa-inline-analysis.c (revision 179003) +++ ipa-inline-analysis.c (working copy) @@ -1149,18 +1149,15 @@ eliminated_by_inlining_prob (gimple stmt { tree rhs = gimple_assign_rhs1 (stmt); tree lhs = gimple_assign_lhs (stmt); - tree inner_rhs = rhs; - tree inner_lhs = lhs; + tree inner_rhs = get_base_address (rhs); + tree inner_lhs = get_base_address (lhs); bool rhs_free = false; bool lhs_free = false; - while (handled_component_p (inner_lhs) - || TREE_CODE (inner_lhs) == MEM_REF) - inner_lhs = TREE_OPERAND (inner_lhs, 0); - while (handled_component_p (inner_rhs) - || TREE_CODE (inner_rhs) == ADDR_EXPR - || TREE_CODE (inner_rhs) == MEM_REF) - inner_rhs = TREE_OPERAND (inner_rhs, 0); + if (!inner_rhs) + inner_rhs = rhs; + if (!inner_lhs) + inner_lhs = lhs; if (unmodified_parm (stmt, inner_rhs)) rhs_free = true;