public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Yury Gribov <y.gribov@samsung.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	       Konstantin Serebryany <kcc@gcc.gnu.org>,
	       Dmitry Vyukov <dvyukov@google.com>,
	       Viacheslav Garbuzov <v.garbuzov@samsung.com>,
	       Marek Polacek <polacek@redhat.com>
Subject: Re: [PATCH] Move Asan instrumentation to sanopt pass
Date: Fri, 18 Jul 2014 15:38:00 -0000	[thread overview]
Message-ID: <20140718144632.GF3003@laptop.redhat.com> (raw)
In-Reply-To: <53C922DE.6020000@samsung.com>

On Fri, Jul 18, 2014 at 05:36:30PM +0400, Yury Gribov wrote:
> The patch was bootstrapped, regtested and asan-bootstrapped on x64.

Thanks for working on this.

For formatting, can you please just replace 8 spaces with tabs
in the ^+ lines in the patch?
sed '/^+/s/        /\t/g' or so.
Can you avoid using // comments in code that uses /* */ comments?

If all the ifns have a bitmask argument, one question is if we really
want ASAN_LOAD vs. ASAN_STORE, instead of a single ASAN_CHECK that
would actually have ASAN_CHECK_IS_STORE as one of the flags.

>  pass_sanopt::execute (function *fun)
>  {
>    basic_block bb;
> +  gimple_stmt_iterator gsi;
>  
> +  int asan_num_accesses = 0;

IMHO you should guard this with if (flag_sanitize & SANITIZE_ADDRESS),
to avoid the cost for -fsanitize=undefined, thread etc.

> +  FOR_EACH_BB_FN (bb, fun)
> +    for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> +      {
> + 	gimple stmt = gsi_stmt (gsi);
> +	if (is_gimple_call (stmt) && gimple_call_internal_p (stmt))
> +	  {
> +	    enum internal_fn ifn = gimple_call_internal_fn (stmt);
> +	    switch (ifn)
> +	      {
> +	      case IFN_ASAN_LOAD:
> +	      case IFN_ASAN_STORE:
> +		{
> +		  ++asan_num_accesses;
> +		  break;
> +		}
> +	      default:
> +		break;
> +	      }
> +	    }
> +        }
> +
> +  bool use_calls = ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD < INT_MAX
> +    && asan_num_accesses >= ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD;
> +    

> --- a/gcc/gimple-iterator.h
> +++ b/gcc/gimple-iterator.h
> @@ -116,6 +116,7 @@ gsi_start_bb (basic_block bb)
>    gimple_seq *seq;
>  
>    seq = bb_seq_addr (bb);
> +  gcc_assert (seq);
>    i.ptr = gimple_seq_first (*seq);
>    i.seq = seq;
>    i.bb = bb;

Uh.  Can you please explain this?  That sounds weird.

	Jakub

  reply	other threads:[~2014-07-18 14:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 13:39 Yury Gribov
2014-07-18 15:38 ` Jakub Jelinek [this message]
2014-07-22  9:03   ` Yury Gribov
2014-07-23 14:42     ` Yury Gribov
2014-07-22 14:06 ` Richard Biener
2014-07-22 14:20   ` Yury Gribov
2014-07-22 14:48     ` Richard Biener
2014-07-23 20:33       ` Jakub Jelinek
2014-07-24  6:35         ` Yury Gribov
2014-07-24  8:28           ` Jakub Jelinek
2014-07-28 14:26             ` Yury Gribov
2014-08-01  7:18               ` Jakub Jelinek
2014-08-01  9:07                 ` Richard Biener
2014-08-08  6:11                   ` [PATCH 1/2] Support fnspecs for internal functions Yury Gribov
2014-08-08  8:07                     ` Jakub Jelinek
2014-08-11  6:13                       ` Yury Gribov
2014-08-08  6:11                 ` [PATCH 2/2] Move Asan instrumentation to sanopt pass Yury Gribov
2014-08-08  8:09                   ` Jakub Jelinek
2014-08-11  6:12                     ` Yury Gribov
2014-07-18 17:28 [PATCH] " Yuri Gribov
     [not found] ` <20140718172323.GL3003@laptop.redhat.com>
2014-07-18 18:55   ` Yuri Gribov
2014-07-19  9:34     ` Jakub Jelinek
2014-07-19 19:33       ` Yuri Gribov

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=20140718144632.GF3003@laptop.redhat.com \
    --to=jakub@redhat.com \
    --cc=dvyukov@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kcc@gcc.gnu.org \
    --cc=polacek@redhat.com \
    --cc=v.garbuzov@samsung.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).