Re: [PATCH] Asan static optimization (draft)

2014-08-19 Thread Konstantin Serebryany
BTW, here is one particular kind of static analysis which I am very much interested in: https://code.google.com/p/address-sanitizer/wiki/CompileTimeOptimizations#Escape_analysis_for_use-after-return Here we can prove that a does not escape foo() and thus we may avoid putting it on fake stack. int

Re: [PATCH] Asan static optimization (draft)

2014-08-19 Thread Konstantin Serebryany
On Mon, Aug 18, 2014 at 1:05 PM, Yuri Gribov wrote: > On Fri, Aug 15, 2014 at 10:34 PM, Konstantin Serebryany > 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 bran

Re: [PATCH] Asan static optimization (draft)

2014-08-18 Thread Yuri Gribov
On Fri, Aug 15, 2014 at 10:34 PM, Konstantin Serebryany 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

Re: [PATCH] Asan static optimization (draft)

2014-08-15 Thread Konstantin Serebryany
On Thu, Aug 14, 2014 at 11:55 PM, Yuri Gribov wrote: > On Thu, Aug 14, 2014 at 8:53 PM, Konstantin Serebryany > wrote: >> In order for your work to be generally useful, I'd ask several things: >> - Update >> https://code.google.com/p/address-sanitizer/wiki/CompileTimeOptimizations >> with exampl

Re: [PATCH] Asan static optimization (draft)

2014-08-15 Thread Yuri Gribov
On Fri, Aug 8, 2014 at 2:43 PM, Dmitry Vyukov wrote: >> Similar optimization could be used for tsan builtins, or some of the ubsan >> builtins (which is the reason why the pass is called sanopt). > > That would be great. > Note that tsan optimizations must be based around a different > criteria. A

Re: [PATCH] Asan static optimization (draft)

2014-08-14 Thread Yuri Gribov
On Thu, Aug 14, 2014 at 8:53 PM, Konstantin Serebryany wrote: > In order for your work to be generally useful, I'd ask several things: > - Update > https://code.google.com/p/address-sanitizer/wiki/CompileTimeOptimizations > with examples that will be handled Done (to be honest I only plan to do

Re: [PATCH] Asan static optimization (draft)

2014-08-14 Thread Konstantin Serebryany
Indeed, thanks for working on this. We've been wanting such optimization phase from day one, but never got to implementing it (except for a few simple ones). https://code.google.com/p/address-sanitizer/wiki/CompileTimeOptimizations There have been several attempts outside of our team to do such opt

Re: [PATCH] Asan static optimization (draft)

2014-08-08 Thread Dmitry Vyukov
On Fri, Aug 8, 2014 at 2:37 PM, Jakub Jelinek wrote: > On Fri, Aug 08, 2014 at 02:26:25PM +0400, Yury Gribov wrote: >> I have been working on Asan global optimization pass lately. The goal is to >> remove redundant Asan checks from sanitized code. This should hopefully >> reduce Asan's speed/size

Re: [PATCH] Asan static optimization (draft)

2014-08-08 Thread Jakub Jelinek
On Fri, Aug 08, 2014 at 02:26:25PM +0400, Yury Gribov wrote: > I have been working on Asan global optimization pass lately. The goal is to > remove redundant Asan checks from sanitized code. This should hopefully > reduce Asan's speed/size overhead (which is currently ~2x). The patch is not > yet r

[PATCH] Asan static optimization (draft)

2014-08-08 Thread Yury Gribov
Hi all, I have been working on Asan global optimization pass lately. The goal is to remove redundant Asan checks from sanitized code. This should hopefully reduce Asan's speed/size overhead (which is currently ~2x). The patch is not yet ready for trunk (e.g. I haven't done bootstrap, etc. but