From patchwork Wed Feb 18 21:18:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 441169 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1E53D1400DE for ; Thu, 19 Feb 2015 08:18:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=Gf/cLUDFmUaYOrn+s UKrQZ7JNdPQbP2d/f/RNkrlwgZgkUNvb9ppv0ewy2oM9YDe0VN6YmOMW5lQLmJrE avLJbcqA+T7lHSfvdskAcRmf+ARjP0TRbSFkqkxYUDLKq3t7HoU6hc72O9wGw6bT DZVQwegoWBqe78Lm8ncM0j1Fxw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=evnDoSGBU9wTVwvFNuuvH09 dxUI=; b=aKjMPAtWFQWtQgDwF89Z7S2ujchgnijFet/N2aNa9LDyDHNcnjQW+gB NC+X9TCINiDl9WuP53jN4ykT3egAly2QYj7ULOVYPJSTgv6BU14JYjDMb5u90mJk 4iQQOLYt3LI3I8/1yqt+rvTR+r2CHZnTD0Hse+ADh6EJtG3eG4Yk= Received: (qmail 21607 invoked by alias); 18 Feb 2015 21:18:25 -0000 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 Received: (qmail 21595 invoked by uid 89); 18 Feb 2015 21:18:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Feb 2015 21:18:22 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-03.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YOC0f-0002l0-EA from Tom_deVries@mentor.com ; Wed, 18 Feb 2015 13:18:17 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-03.mgc.mentorg.com (137.202.0.108) with Microsoft SMTP Server id 14.3.224.2; Wed, 18 Feb 2015 21:18:15 +0000 Message-ID: <54E50190.4050409@mentor.com> Date: Wed, 18 Feb 2015 22:18:08 +0100 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Richard Biener CC: Jakub Jelinek , GCC Patches Subject: Re: [Patch] Add option ftree-stdarg-opt References: <54E3301C.8010504@mentor.com> In-Reply-To: On 17-02-15 13:26, Richard Biener wrote: > On Tue, Feb 17, 2015 at 1:12 PM, Tom de Vries wrote: >> Hi, >> >> this patch adds option ftree-stdarg-opt, which switches pass_stdarg on or >> off. >> >> Pass_stdarg does an optimization on cfun->va_list_gpr/fpr_size, and since >> it's an optimization, it's useful to be able to switch it off in case of a >> problem with the pass. >> >> This is not a regression or documentation fix, so it doesn't classify as a >> stage 4 patch. I could imagine it still being included in stage4 because it >> adds the possibility for a workaround in case of problems. >> >> Bootstrapped and reg-tested on x86_64. >> >> OK for stage1 (or even stage 4)? > > New options need to be documented in invoke.texi. I also wonder > if 'stdarg' is a term known to programmers. I'd rather document it > as > "Optimize the prologue of variadic argument functions with respect > to usage of those arguments" > > And please omit 'tree' from the flag, thus -fstdarg-opt > > Otherwise generally fine for stage4. > Updated patch accordingly, re-tested and committed as attached. Thanks, - Tom 2015-02-18 Tom de Vries * common.opt (fstdarg-opt): New option. * tree-stdarg.c (pass_stdarg::gate): Use flag_stdarg_opt. * doc/invoke.texi (@item Optimization Options): Add -fstdarg-opt. (@item -fstdarg-opt): New item. --- gcc/common.opt | 4 ++++ gcc/doc/invoke.texi | 7 ++++++- gcc/tree-stdarg.c | 5 +++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/common.opt b/gcc/common.opt index e0d4a1d..4fa12f5 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2069,6 +2069,10 @@ fssa-phiopt Common Report Var(flag_ssa_phiopt) Optimization Optimize conditional patterns using SSA PHI nodes +fstdarg-opt +Common Report Var(flag_stdarg_opt) Init(1) Optimization +Optimize amount of stdarg registers saved to stack at start of function + fvariable-expansion-in-unroller Common Report Var(flag_variable_expansion_in_unroller) Optimization Apply variable expansion when loops are unrolled diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4a79b48..ef4cc75 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -430,7 +430,7 @@ Objective-C and Objective-C++ Dialects}. -fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol -fsplit-ivs-in-unroller -fsplit-wide-types -fssa-phiopt @gol -fstack-protector -fstack-protector-all -fstack-protector-strong @gol --fstack-protector-explicit -fstrict-aliasing @gol +-fstack-protector-explicit -fstdarg-opt -fstrict-aliasing @gol -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol -ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol @@ -9867,6 +9867,11 @@ references to local frame addresses. Like @option{-fstack-protector} but only protects those functions which have the @code{stack_protect} attribute +@item -fstdarg-opt +@opindex fstdarg-opt +Optimize the prologue of variadic argument functions with respect to usage of +those arguments. + @item -fsection-anchors @opindex fsection-anchors Try to reduce the number of symbolic address calculations by using diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index 2cf0ca3..17d51a2 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -704,8 +704,9 @@ public: /* opt_pass methods: */ virtual bool gate (function *fun) { - /* This optimization is only for stdarg functions. */ - return fun->stdarg != 0; + return (flag_stdarg_opt + /* This optimization is only for stdarg functions. */ + && fun->stdarg != 0); } virtual unsigned int execute (function *); -- 1.9.1