From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36776 invoked by alias); 20 Oct 2016 12:09:42 -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 36712 invoked by uid 89); 20 Oct 2016 12:09:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Attached X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Oct 2016 12:09:37 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2337AAD20; Thu, 20 Oct 2016 12:09:35 +0000 (UTC) Date: Thu, 20 Oct 2016 12:09:00 -0000 From: Richard Biener To: kugan cc: Jan Hubicka , "gcc-patches@gcc.gnu.org" Subject: Re: [RFC][IPA-VRP] ADDR_EXPR and nonnull In-Reply-To: <76ab5854-4c4e-ae4a-8d33-e2b1bdd02522@linaro.org> Message-ID: References: <0987d0d3-9b7b-eeb8-cf2a-17d1d0df7f49@linaro.org> <20161019142620.GA69032@kam.mff.cuni.cz> <26222603-662f-57b9-8087-724cc5e88191@linaro.org> <76ab5854-4c4e-ae4a-8d33-e2b1bdd02522@linaro.org> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2016-10/txt/msg01634.txt.bz2 On Thu, 20 Oct 2016, kugan wrote: > Hi Richard, > > > On 20/10/16 18:41, Richard Biener wrote: > > On Thu, 20 Oct 2016, kugan wrote: > > > > > > > > > > > On 20/10/16 01:26, Jan Hubicka wrote: > > > > > > Would excluding weak symbols (I believe I can check DECL_WEAK for > > > > > > this) > > > > > > good > > > > > > enough. Or looking for acceptable subset would work? > > > > > > > > > > I think we should add a symtab helper to tell if address_nonzero_p (if > > > > > that doesn't aleady exist). > > > > > > > > We have node->nonzero_address() > > > > > > Thanks for the pointer. Here is an attempt. Does this look OK? > > > > > > + if (TREE_CODE (arg) == ADDR_EXPR) > > > + { > > > + /* See if the AADR_EXPR is nonnull. */ > > > + varpool_node *node = NULL; > > > + tree base = TREE_OPERAND (arg, 0); > > > + base = get_base_address (base); > > > + > > > + if (decl_address_ip_invariant_p (base) > > > + || !is_global_var (base)) > > > + { > > > + /* If the symbol address is local or > > > + constant. */ > > > > "constant" doesn't matter. You want > > > > if (TREE_CODE (base) == CONST_DECL > > || TREE_CODE (base) == PARM_DECL > > || TREE_CODE (base) == RESULT_DECL) > > addr_nonzero = true; > > else if (VAR_P (base)) > > addr_nonzero = ! is_global_var (base) || (varpool_node::get > > (base)->nonzero_address ()); > > Attached patch does this. Bootstrapped and regression tested on > x86_64-linux-gnu. Is this OK? Ok with + } + + if ((TREE_CODE (arg) == SSA_NAME + && param_type + && get_ptr_nonnull (arg)) + || addr_nonzero) { re-factored as + } else if (TREE_CODE (arg) == SSA_NAME + && param_type + && get_ptr_nonnull (arg)) addr_nonzero = true; if (addr_nonzero) Richard. > Thanks, > Kugan > > > > > Richard. > > > > > + addr_nonzero = true; > > > + } > > > + else > > > + { > > > + /* If symbol address is nonzero_address. */ > > > + node = varpool_node::get (base); > > > + if (node && node->nonzero_address ()) > > > + addr_nonzero = true; > > > + } > > > + } > > > > > > Attached patch passes bootstrap and regression testing on x86_64-linu-gnu. > > > > > > Thanks, > > > Kugan > > > > > > > > > > > Honza > > > > > > > > > > Richard. > > > > > > > > > > > Thanks, > > > > > > Kugan > > > > > > > > > > > > > > > > > > > > Richard. > > > > > > > > > > > > > > > Attached patch bootstraps and regression testing didn't > > > > > > > > introduce > > > > > > > > any new > > > > > > > > regressions. > > > > > > > > > > > > > > > > Thanks, > > > > > > > > Kugan > > > > > > > > > > > > > > > > > > > > > > > > gcc/ChangeLog: > > > > > > > > > > > > > > > > 2016-10-19 Kugan Vivekanandarajah > > > > > > > > > > > > > > > > * ipa-prop.c (ipa_compute_jump_functions_for_edge): Set > > > > > > > > value range to nonull for ADDR_EXPR. > > > > > > > > > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > > > > > > > > > 2016-10-19 Kugan Vivekanandarajah > > > > > > > > > > > > > > > > * gcc.dg/ipa/vrp5.c: New test. > > > > > > > > * gcc.dg/ipa/vrp6.c: New test. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Richard Biener > > > > > SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, > > > > > HRB > > > > > 21284 (AG Nuernberg) > > > > > > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)