public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: "Martin Liška" <mliska@suse.cz>
Cc: gcc-patches@gcc.gnu.org, Nathan Sidwell <nathan@acm.org>
Subject: Re: [PATCH] Add malloc predictor (PR middle-end/83023).
Date: Tue, 31 Jul 2018 09:25:00 -0000	[thread overview]
Message-ID: <20180731092546.GG29444@kam.mff.cuni.cz> (raw)
In-Reply-To: <b712ea25-3795-65fb-db50-d95a58889dd0@suse.cz>

> 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  <mliska@suse.cz>
> 
>         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  <mliska@suse.cz>
> 
>         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

  parent reply	other threads:[~2018-07-31  9:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-26 14:43 Martin Liška
2018-07-26 15:00 ` Marc Glisse
2018-07-27 12:05   ` Martin Liška
2018-07-27 12:38     ` Marc Glisse
2018-08-01 11:04       ` Martin Liška
2018-08-01 11:28       ` Martin Liška
2018-08-01 12:25         ` Marc Glisse
2018-08-01 12:44           ` Martin Liška
2018-08-01 15:05             ` Marc Glisse
2018-08-02 10:59               ` Martin Liška
2018-08-07 11:51                 ` Jan Hubicka
2018-08-07 11:59                   ` Martin Liška
2018-08-01 15:11           ` Nathan Sidwell
2018-07-31  9:25 ` Jan Hubicka [this message]
2018-08-01 11:30   ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180731092546.GG29444@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=nathan@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).