From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15359 invoked by alias); 22 May 2014 12:49:58 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 15345 invoked by uid 89); 22 May 2014 12:49:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 22 May 2014 12:49:56 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7F37DAD2A; Thu, 22 May 2014 12:49:53 +0000 (UTC) Date: Thu, 22 May 2014 12:49:00 -0000 From: Martin Jambor To: Richard Biener Cc: GCC Patches , Jan Hubicka Subject: Re: [PATCH 7/7] Plug ipa-prop escape analysis into gimple_call_arg_flags Message-ID: <20140522124952.GA13095@virgil.suse> Mail-Followup-To: Richard Biener , GCC Patches , Jan Hubicka References: <20140521131634.178838544@virgil.suse.cz> <20140521131634.646352575@virgil.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg01868.txt.bz2 Hi, On Wed, May 21, 2014 at 04:27:32PM +0200, Richard Biener wrote: > On Wed, May 21, 2014 at 3:16 PM, Martin Jambor wrote: > > Hi, > > > > this demonstrates how results of ipa-prop escape analysis from > > previous patches can be used at a later stage of compilation by > > directly returning them from gimple_call_arg_flags which currently > > relies on fnspec annotations. > > > > Bootstrapped and tested on x86_64-linux and also passes LTO bootstrap. > > I have only had a brief look at behavior of this in SPEC 2006 and for > > example in astar 1.19% of invocations of gimple_call_arg_flags return > > noescape where we previously never did and in calculix this increases > > from 15.62% (from annotations) to 18.14%. Noclobber flag is reported > > far less often still but for example in gamess that number raises from > > 5.21% to 7.66%. > > > > Thanks, > > > > Martin > > > > > > 2014-04-30 Martin Jambor > > > > * gimple.c: Include cgraph.h. > > (gimple_call_arg_flags): Also query bitmaps in cgraph_node. > > > > Index: src/gcc/gimple.c > > =================================================================== > > --- src.orig/gcc/gimple.c > > +++ src/gcc/gimple.c > > @@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. > > #include "demangle.h" > > #include "langhooks.h" > > #include "bitmap.h" > > - > > +#include "cgraph.h" > > > > /* All the tuples have their operand vector (if present) at the very bottom > > of the structure. Therefore, the offset required to find the > > @@ -1349,32 +1349,50 @@ int > > gimple_call_arg_flags (const_gimple stmt, unsigned arg) > > { > > tree attr = gimple_call_fnspec (stmt); > > + int ret; > > > > - if (!attr || 1 + arg >= (unsigned) TREE_STRING_LENGTH (attr)) > > - return 0; > > - > > - switch (TREE_STRING_POINTER (attr)[1 + arg]) > > + if (attr && 1 + arg < (unsigned) TREE_STRING_LENGTH (attr)) > > { > > - case 'x': > > - case 'X': > > - return EAF_UNUSED; > > - > > - case 'R': > > - return EAF_DIRECT | EAF_NOCLOBBER | EAF_NOESCAPE; > > - > > - case 'r': > > - return EAF_NOCLOBBER | EAF_NOESCAPE; > > - > > - case 'W': > > - return EAF_DIRECT | EAF_NOESCAPE; > > - > > - case 'w': > > - return EAF_NOESCAPE; > > + switch (TREE_STRING_POINTER (attr)[1 + arg]) > > + { > > + case 'x': > > + case 'X': > > + ret = EAF_UNUSED; > > + break; > > + case 'R': > > + ret = EAF_DIRECT | EAF_NOCLOBBER | EAF_NOESCAPE; > > + break; > > + case 'r': > > + ret = EAF_NOCLOBBER | EAF_NOESCAPE; > > + break; > > + case 'W': > > + ret = EAF_DIRECT | EAF_NOESCAPE; > > + break; > > + case 'w': > > + ret = EAF_NOESCAPE; > > + break; > > + case '.': > > + default: > > + ret = 0; > > + } > > + } > > + else > > + ret = 0; > > > > - case '.': > > - default: > > - return 0; > > + tree callee_decl = gimple_call_fndecl (stmt); > > + if (callee_decl) > > + { > > + cgraph_node *callee_node = cgraph_get_node (callee_decl); > > + if (callee_node) > > + { > > + if (cgraph_param_noescape_p (callee_node, arg)) > > + ret |= EAF_NOESCAPE; > > + if (cgraph_param_noclobber_p (callee_node, arg)) > > + ret |= EAF_NOCLOBBER; > > That's quite expensive. I guess we need a better way to store > those? if we want to avoid the cgraph_node lookup, then I think we need to store this information in the decl or struct function. That is certainly possible and might even be more appropriate. Thanks, Martin > > > + } > > } > > + > > + return ret; > > } > > > > /* Detects return flags for the call STMT. */ > >