[PATCH] D87737: Add -fprofile-update={atomic,prefer-atomic,single}

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 20:39:02 PDT 2020


MaskRay created this revision.
MaskRay added reviewers: davidxl, vsk, xur.
Herald added subscribers: cfe-commits, dang, jfb.
Herald added a project: clang.
MaskRay requested review of this revision.

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 <https://reviews.llvm.org/D50867>) and -fprofile-arcs (b5ef137c11b1cc6ae839ee75b49233825772bdd0 <https://reviews.llvm.org/rGb5ef137c11b1cc6ae839ee75b49233825772bdd0>).
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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87737

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/code-coverage-tsan.c
  clang/test/CodeGen/tsan-instrprof-atomic.c
  clang/test/Driver/fprofile-update.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87737.292079.patch
Type: text/x-patch
Size: 6649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200916/1017b797/attachment-0001.bin>


More information about the cfe-commits mailing list