On Fri, 12 Jun 2020 at 12:29, Jakub Jelinek <ja...@redhat.com> wrote: > > On Fri, Jun 12, 2020 at 09:21:59AM +0200, Marco Elver wrote: > > Adds param tsan-instrument-func-entry-exit, which controls if > > __tsan_func_{entry,exit} calls should be emitted or not. The default > > behaviour is to emit the calls. > > If you want that, I wonder if the spots you've chosen are the best ones. > E.g. shouldn't > if (sanitize_flags_p (SANITIZE_THREAD)) > { > gcall *call = gimple_build_call_internal (IFN_TSAN_FUNC_EXIT, 0); > ... > in gimplify.c have this && param_tsan_instrument_func_entry_exit, so that > we don't waste a call or several in every function when we are going to dump > them all?
Yes, makes sense. Thanks for pointing it out! Done in v2. > And in tsan.c, perhaps instead of changing instrument_gimple twice change: > fentry_exit_instrument |= instrument_gimple (&gsi); > to: > fentry_exit_instrument > |= (instrument_gimple (&gsi) > && param_tsan_instrument_func_entry_exit); > ? Yeah, I was wondering where the best place is. I chose instrument_gimple() because it's the inner-most function controlling if func-entry-exit instrumentation is emitted. But I suppose that function won't be used elsewhere, so your suggestion is simpler. Done in v2. > > gcc/ChangeLog: > > > > * params.opt: Add --param=tsan-instrument-func-entry-exit=. > > * tsan.c (instrument_gimple): Make return value if > > func entry and exit should be instrumented dependent on > > param. > > No tab + 2 spaces please, the further lines should be just tab indented. > And s/ / /. Done for v2. Thanks, -- Marco