[all-commits] [llvm/llvm-project] 3681be: Add -fprofile-update={atomic, prefer-atomic, single}

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Sep 29 10:43:45 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3681be876fea9b270c7a1d2dc41679a399610e06
      https://github.com/llvm/llvm-project/commit/3681be876fea9b270c7a1d2dc41679a399610e06
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-09-29 (Tue, 29 Sep 2020)

  Changed paths:
    M clang/docs/UsersManual.rst
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/test/CodeGen/code-coverage-tsan.c
    M clang/test/CodeGen/tsan-instrprof-atomic.c
    A clang/test/Driver/fprofile-update.c

  Log Message:
  -----------
  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




More information about the All-commits mailing list