From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87010 invoked by alias); 31 Jul 2018 09:25:49 -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 86998 invoked by uid 89); 31 Jul 2018 09:25:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=H*f:sk:b712ea2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Jul 2018 09:25:48 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 321A7541480; Tue, 31 Jul 2018 11:25:46 +0200 (CEST) Date: Tue, 31 Jul 2018 09:25:00 -0000 From: Jan Hubicka To: Martin =?iso-8859-2?Q?Li=B9ka?= Cc: gcc-patches@gcc.gnu.org, Nathan Sidwell Subject: Re: [PATCH] Add malloc predictor (PR middle-end/83023). Message-ID: <20180731092546.GG29444@kam.mff.cuni.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2018-07/txt/msg01894.txt.bz2 > Hi. > > Following patch implements new predictors that annotates malloc-like functions. > These almost every time return a non-null value. > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. > > Ready to be installed? > Martin > > gcc/ChangeLog: > > 2018-07-26 Martin Liska > > PR middle-end/83023 > * predict.c (expr_expected_value_1): Handle DECL_IS_MALLOC > declarations. > * predict.def (PRED_MALLOC_NONNULL): New predictor. > > gcc/testsuite/ChangeLog: > > 2018-07-26 Martin Liska > > PR middle-end/83023 > * gcc.dg/predict-16.c: New test. These are two conceptually different things - wether you return new memory and whether the return value is commonly non-null. While it goes together for majority of malloc function I wonder if this is safe WRT the auto-detected malloc attributes. I do not know how common is code that returns new memory only under some conditions? Honza