public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Yuri Gribov <tetra2005@gmail.com>
To: Konstantin Serebryany <konstantin.s.serebryany@gmail.com>
Cc: Yury Gribov <y.gribov@samsung.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
		Jakub Jelinek <jakub@redhat.com>,
	Marek Polacek <polacek@redhat.com>,
		Dmitry Vyukov <dvyukov@google.com>,
	Dodji Seketeli <dodji@redhat.com>,
		Viacheslav Garbuzov <v.garbuzov@samsung.com>
Subject: Re: [PATCH] Asan static optimization (draft)
Date: Mon, 18 Aug 2014 20:06:00 -0000	[thread overview]
Message-ID: <CAJOtW+6KD_-gS=j6C3tzFJegTRnigNfsn8VxSPXCEB+ZE2hy7Q@mail.gmail.com> (raw)
In-Reply-To: <CAGQ9bdxY_L0DgUQ0-YNjA_=FdeKnJGWRn7B_0dHSgQMDGMKGDA@mail.gmail.com>

On Fri, Aug 15, 2014 at 10:34 PM, Konstantin Serebryany
<konstantin.s.serebryany@gmail.com> wrote:
> If this is -O1 or higher,  then most (but not all) of your cases
> *should* be optimized by the compiler before asan kicks in.

You mean hoisting memory accesses from branches?
Sure, the tests are simplified beyond all limits.
On the other hand even basic aliasing constraints
would obviously prevent optimization of pointer accesses
(but not of Asan checks!).

> (This may be different for GCC-asan because GCC-asan runs a bit too
> early, AFAICT. Maybe this *is* the problem we need to fix).

Thanks for mentioning this, I'll try to experiment
with moving Asan pass across the compilation pipeline and
report my findings.

> I am mainly interested in cases where the general optimizer can not
> possibly improve the code,
> but asan opt can eliminate redundant checks.

As I mentined, I believe that aliasing may often restrict
optimizer's code hoisting ability.
And we certainly need Asan opt for combining checks.

>> I already have a bunch of tests (which I plan to extend further). How
>> should I submit them s.t. they could be reused by LLVM?
>
> Maybe just start accumulating tests on the CompileTimeOptimizations wiki
> (as full functions that one can copy-paste to a .c file and build)?
> Once some new optimization is implemented in a compiler X,
> we'll copy the test with proper harness code (FileCheck/dejagnu/etc)
> to the X's repository

Ok, so I'll firstly post tests on wiki and explicitely reference their
origin when submitting patches.

>> Perhaps there is some prior work on verification of Java
>> range checks optimizers?
>
> There is ton of work for range check optimizers,
> but none of that
> fully applies to asan,
> since asan also checks use-after-free and init-order-fiasco.

Could you give more details? How would
use-after-free/init-order-fiasco influence verification of redundant
elimination?

-Y

  reply	other threads:[~2014-08-18 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 10:26 Yury Gribov
2014-08-08 10:37 ` Jakub Jelinek
2014-08-08 10:43   ` Dmitry Vyukov
2014-08-15  6:59     ` Yuri Gribov
2014-08-14 16:53 ` Konstantin Serebryany
2014-08-15  6:55   ` Yuri Gribov
2014-08-15 18:34     ` Konstantin Serebryany
2014-08-18 20:06       ` Yuri Gribov [this message]
2014-08-19 23:43         ` Konstantin Serebryany
2014-08-20  0:06           ` Konstantin Serebryany

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='CAJOtW+6KD_-gS=j6C3tzFJegTRnigNfsn8VxSPXCEB+ZE2hy7Q@mail.gmail.com' \
    --to=tetra2005@gmail.com \
    --cc=dodji@redhat.com \
    --cc=dvyukov@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=konstantin.s.serebryany@gmail.com \
    --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).