Re: [PATCH] Asan static optimization (draft)

2014-08-19 Thread Konstantin Serebryany
On Mon, Aug 18, 2014 at 1:05 PM, Yuri Gribov tetra2...@gmail.com wrote: On Fri, Aug 15, 2014 at 10:34 PM, Konstantin Serebryany konstantin.s.serebry...@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.

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.

Re: [PATCH] Asan static optimization (draft)

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

Re: [PATCH] Asan static optimization (draft)

2014-08-15 Thread Yuri Gribov
On Thu, Aug 14, 2014 at 8:53 PM, Konstantin Serebryany konstantin.s.serebry...@gmail.com 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

Re: [PATCH] Asan static optimization (draft)

2014-08-15 Thread Yuri Gribov
On Fri, Aug 8, 2014 at 2:43 PM, Dmitry Vyukov dvyu...@google.com 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

Re: [PATCH] Asan static optimization (draft)

2014-08-15 Thread Konstantin Serebryany
On Thu, Aug 14, 2014 at 11:55 PM, Yuri Gribov tetra2...@gmail.com wrote: On Thu, Aug 14, 2014 at 8:53 PM, Konstantin Serebryany konstantin.s.serebry...@gmail.com wrote: In order for your work to be generally useful, I'd ask several things: - Update

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

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

Re: [PATCH] Asan static optimization (draft)

2014-08-08 Thread Dmitry Vyukov
On Fri, Aug 8, 2014 at 2:37 PM, Jakub Jelinek ja...@redhat.com 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