https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64265
--- Comment #11 from Dmitry Vyukov <dvyukov at google dot com> --- >Doing it in gimplify_function_tree is pretty straightforward That's good! >So, the question is just if you want to do it that way... Kostya, can you say anything about llvm? On the tsan issue you said: "We'll need a kind of RAII for tsan entry/exit hooks. When we are adding tsan instrumentation, we need to create a fake class object with a ctor and dtor." Which suggests that you wanted to do it in a similar way in llvm. If we decide to it this way in both compilers, then no support in runtime is required, and gcc can well implement it ahead of llvm.