diff options
| author | Lei Wang <wlei@fb.com> | 2024-10-31 21:28:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-31 21:28:13 -0700 |
| commit | bef3b54ea10a564a2de72f658f2efd64f537c079 (patch) | |
| tree | 65b3d27b88b8b6f756966ab004005e95b036f0f9 /clang/lib/Driver/ToolChain.cpp | |
| parent | 96b14f2ccb749010daea7a67963abed83456318c (diff) | |
[InstrPGO] Avoid using global variable to fix potential data race (#114364)
In https://github.com/llvm/llvm-project/pull/109837, it sets a global
variable(`PGOInstrumentColdFunctionOnly`) in PassBuilderPipelines.cpp
which introduced a data race detected by TSan. To fix this, I decouple
the flag setting, the flags are now set
separately(`instrument-cold-function-only-path` is required to be used
with `--pgo-instrument-cold-function-only`).
Diffstat (limited to 'clang/lib/Driver/ToolChain.cpp')
| -rw-r--r-- | clang/lib/Driver/ToolChain.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 6d3ede406910..bdf3da0c96ad 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -899,7 +899,9 @@ bool ToolChain::needsProfileRT(const ArgList &Args) { Args.hasArg(options::OPT_fprofile_instr_generate) || Args.hasArg(options::OPT_fprofile_instr_generate_EQ) || Args.hasArg(options::OPT_fcreate_profile) || - Args.hasArg(options::OPT_forder_file_instrumentation); + Args.hasArg(options::OPT_forder_file_instrumentation) || + Args.hasArg(options::OPT_fprofile_generate_cold_function_coverage) || + Args.hasArg(options::OPT_fprofile_generate_cold_function_coverage_EQ); } bool ToolChain::needsGCovInstrumentation(const llvm::opt::ArgList &Args) { |
