diff options
author | Fangrui Song <i@maskray.me> | 2020-09-29 10:38:51 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2020-09-29 10:43:23 -0700 |
commit | 3681be876fea9b270c7a1d2dc41679a399610e06 (patch) | |
tree | b953e88424a14ceed004a9eb2815ccfa403e9c86 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 5409e4831fef7d2fa13fadd14ce53a85a99b1682 (diff) | |
download | llvm-3681be876fea9b270c7a1d2dc41679a399610e06.zip llvm-3681be876fea9b270c7a1d2dc41679a399610e06.tar.gz llvm-3681be876fea9b270c7a1d2dc41679a399610e06.tar.bz2 |
Add -fprofile-update={atomic,prefer-atomic,single}
GCC 7 introduced -fprofile-update={atomic,prefer-atomic} (prefer-atomic is for
best efforts (some targets do not support atomics)) to increment counters
atomically, which is exactly what we have done with -fprofile-instr-generate
(D50867) and -fprofile-arcs (b5ef137c11b1cc6ae839ee75b49233825772bdd0).
This patch adds the option to clang to surface the internal options at driver level.
GCC 7 also turned on -fprofile-update=prefer-atomic when -pthread is specified,
but it has performance regression
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89307). So we don't follow suit.
Differential Revision: https://reviews.llvm.org/D87737
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 4222433..b402f53 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -884,6 +884,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.DebugRangesBaseAddress = Args.hasArg(OPT_fdebug_ranges_base_address); setPGOInstrumentor(Opts, Args, Diags); + Opts.AtomicProfileUpdate = Args.hasArg(OPT_fprofile_update_EQ); Opts.InstrProfileOutput = std::string(Args.getLastArgValue(OPT_fprofile_instrument_path_EQ)); Opts.ProfileInstrumentUsePath = |