public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Yury Gribov <y.gribov@samsung.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Optimize UBSAN_NULL checks, add sanopt.c
Date: Wed, 05 Nov 2014 11:23:00 -0000	[thread overview]
Message-ID: <20141105112337.GY20462@redhat.com> (raw)
In-Reply-To: <20141105105020.GC5026@tucnak.redhat.com>

On Wed, Nov 05, 2014 at 11:50:20AM +0100, Jakub Jelinek wrote:
> On Wed, Nov 05, 2014 at 11:29:19AM +0100, Marek Polacek wrote:
> > On Wed, Nov 05, 2014 at 12:54:37PM +0300, Yury Gribov wrote:
> > > Are you going to work on ASan soon?  I could rebase my patches on top of
> > > Marek's infrastructure.
> > 
> > I'm not going to work on ASan today or tomorrow, but it'd be nice to
> > get this ASan opt in in this stage1.
> > 
> > So if you can rebase your patch, I think that will be appreciated.
> 
> Note, the algorithm we were discussing with Honza for the
> "is there any possibility of a freeing call on the path between a dominating
> and dominated ASAN_CHECK"

Right.  Let me see then if I can implement the following soon, maybe
it makes sense to rebase Yuri's patch only on top of this algorithm.

> problem was to compute it lazily; have flags for asan per-bb:
> 1) bb might contain a !nonfreeing_call_p
> 2) there is a bb with flag 1) set in some path between imm(bb) and bb
> 3) flag whether 2) has been computed already
> 4) some temporary "being visited" flag
> and the algorithm:
> 1) when walking a bb, if you encounter a !nonfreeing_call_p call, either
>    immediately nuke recorded earlier ASAN_CHECKs from the current bb,
>    or use gimple_uids for lazily doing that; but in any case, record
>    the flag 1) for the current bb
> 2) if you are considering ASAN_CHECK in a different bb than ASAN_CHECK
>    it is dominating, check the 2) flag on the current bb, then on
>    get_immediate_dominator (bb) etc. until you reach the bb with the
>    dominating bb, if the 2) flag is set on any of them, don't optimize;
>    if the 2) flag is not computed on any of these (i.e. flag 3) unset),
>    then compute it recursively; set the 4) flag on a bb, for incoming
>    edges if the src bb is not the imm(bb) of the original bb, and does
>    not have 4) flag set: if it has 1) set, use 1, if it has 3) flag set,
>    use 2), otherwise recurse (and or the result); unset 4) flag before
>    returning; or so.
> 
> For tsan, pretty much the same thing, just with different 1)/2)/3)
> flags and different test for that (instead of !nonfreeing_call_p
> we are interested in: uses atomics or calls that might use atomics
> or other pthread_* synchronization primitives).

	Marek

  reply	other threads:[~2014-11-05 11:23 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03 14:28 Marek Polacek
2014-11-03 15:35 ` Jakub Jelinek
2014-11-04 18:36   ` Marek Polacek
2014-11-04 19:18     ` Jakub Jelinek
2014-11-05  9:19 ` Yury Gribov
2014-11-05  9:33   ` Jakub Jelinek
2014-11-05  9:54     ` Yury Gribov
2014-11-05 10:29       ` Marek Polacek
2014-11-05 10:50         ` Jakub Jelinek
2014-11-05 11:23           ` Marek Polacek [this message]
2014-11-05 12:16             ` Yury Gribov
2014-11-05 12:22               ` Jakub Jelinek
2014-11-05 12:34                 ` Yury Gribov
2014-11-05 13:13                   ` Yury Gribov
2014-11-05 13:23                     ` Jakub Jelinek
2014-11-05 13:48                       ` Yury Gribov
2014-11-12  9:52                         ` Maxim Ostapenko
2014-11-12 10:11                           ` Jakub Jelinek
2014-11-12 11:54                             ` Maxim Ostapenko
2014-11-12 22:53                               ` [PATCH] Propagate nonfreeing_call_p using ipa-pure-const Jakub Jelinek
2014-11-12 23:11                                 ` Jan Hubicka
2014-11-13  7:45                                   ` Jakub Jelinek
2014-11-13  8:44                                   ` [PATCH] Propagate nonfreeing_call_p using ipa-pure-const (take 2) Jakub Jelinek
2014-11-13 11:08                                     ` Richard Biener
2014-11-13 12:05                                     ` Jakub Jelinek
2014-11-14 17:44                                       ` Jakub Jelinek
2014-11-14 17:51                                         ` Jan Hubicka
2014-11-11 17:49           ` [RFC PATCH] Optimize ASAN_CHECK checks Jakub Jelinek
2014-11-12  9:26             ` Yury Gribov
2014-11-12 10:35               ` Jakub Jelinek
2014-11-12 11:12                 ` Yury Gribov
2014-11-12 22:41                   ` [PATCH] " Jakub Jelinek
2014-11-14 11:31                     ` Dodji Seketeli
2014-11-14 12:02                       ` Jakub Jelinek
2014-11-14 12:16                         ` Dodji Seketeli
2014-11-14 12:18                           ` Jakub Jelinek
2014-11-14 12:28                             ` Richard Biener
2014-11-14 13:06                               ` Jakub Jelinek
2014-11-14 17:30                           ` Jakub Jelinek
2014-11-25 17:26                 ` [PATCH] Enhance ASAN_CHECK optimization Yury Gribov
2014-11-26  9:59                   ` Jakub Jelinek
2014-11-26 18:43                     ` ygribov
2014-11-26 18:50                       ` Jakub Jelinek
2014-11-26 18:54                         ` ygribov
2014-11-26 19:00                           ` Jakub Jelinek
2014-12-03  8:09                   ` [PATCHv2] " Yury Gribov
2014-12-03  8:36                     ` Jakub Jelinek
2014-12-03  9:04                       ` Yury Gribov
2014-12-03  9:07                         ` Jakub Jelinek

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=20141105112337.GY20462@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=y.gribov@samsung.com \
    /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).