Hi, some time ago we were requested to implement a -finstrument-functions-once switch in the compiler, with the semantics that the profiling functions be called only once per instrumented function. The goal was to make it possible to use it in (large) production binaries to do function-level coverage, so the overhead must be minimum and, in particular, there is no protection against data races so the "once" moniker is imprecise. Tested on x86-64/Linux, OK for the mainline? 2022-05-24 Eric Botcazou * common.opt (finstrument-functions): Set explicit value. (-finstrument-functions-once): New option. * doc/invoke.texi (Program Instrumentation Options): Document it. * gimplify.c (build_instrumentation_call): New static function. (gimplify_function_tree): Invoke it to emit the instrumentation calls if -finstrument-functions[-once] is specified. -- Eric Botcazou