This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Asan static optimization (draft)


On Fri, Aug 8, 2014 at 2:37 PM, Jakub Jelinek <jakub@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 speed/size overhead (which is currently ~2x). The patch is not
>> yet ready for trunk (e.g. I haven't done bootstrap, etc. but Asan testsuite
>> passed wo errors) but I thought I'd send it for preliminary review of
>> algorithm and data structures (*).
>
> Thanks for working on it, I've just quickly skimmed it and it looks
> reasonable.
>
> 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. Any unlock/release operations must reset set of already
checked locations. Also tsan does not care about non-escaped to other
threads variables; e.g. it does not care about
local_stack_array[rand()] expressions, while asan does.


>> 3) in addition to redundant check removal, we could also move duplicate
>> checks from e.g. branches of if-statement to their dominators.
>
> For that you'd need to be extra careful, you would need to avoid doing that
> if any path doesn't contain the check, or if there are calls that e.g. could
> not return (abort/exit/have infinite loop) in between, etc.
>
>         Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]