From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10272 invoked by alias); 21 May 2014 13:31:24 -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 10121 invoked by uid 89); 21 May 2014 13:31:23 -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: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 21 May 2014 13:30:47 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wn6bN-0000LV-Qs for gcc-patches@gcc.gnu.org; Wed, 21 May 2014 09:30:44 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57669 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn6bN-0000L0-I9 for gcc-patches@gcc.gnu.org; Wed, 21 May 2014 09:30:37 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0538EAD2C for ; Wed, 21 May 2014 13:30:35 +0000 (UTC) Resent-From: Martin Jambor Resent-Date: Wed, 21 May 2014 15:30:34 +0200 Resent-Message-ID: <20140521133034.GH15866@virgil.suse> Resent-To: GCC Patches Message-Id: <20140521131634.646352575@virgil.suse.cz> User-Agent: quilt/0.60-8.1.3 Date: Wed, 21 May 2014 13:31:00 -0000 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PATCH 7/7] Plug ipa-prop escape analysis into gimple_call_arg_flags References: <20140521131634.178838544@virgil.suse.cz> Content-Disposition: inline; filename=plug_ipa_escape_into_pta.diff X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg01772.txt.bz2 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; + } } + + return ret; } /* Detects return flags for the call STMT. */