[all-commits] [llvm/llvm-project] c0c1c3: Revert "[InstrProfiling] Emit bias variable eagerly"

Petr Hosek via All-commits all-commits at lists.llvm.org
Tue Aug 10 23:21:40 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c0c1c3cf93ec089887944027ebfa95da03f8040b
      https://github.com/llvm/llvm-project/commit/c0c1c3cf93ec089887944027ebfa95da03f8040b
  Author: Petr Hosek <phosek at google.com>
  Date:   2021-08-10 (Tue, 10 Aug 2021)

  Changed paths:
    M llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    R llvm/test/Instrumentation/InstrProfiling/bias-var.ll

  Log Message:
  -----------
  Revert "[InstrProfiling] Emit bias variable eagerly"

This reverts commit 6660cec568504df47d9becb0c552c20577880df8 since
it was superseded by https://reviews.llvm.org/D98061.


  Commit: 389dc94d4be7a75c243528981a25260c1c7a6103
      https://github.com/llvm/llvm-project/commit/389dc94d4be7a75c243528981a25260c1c7a6103
  Author: Petr Hosek <phosek at google.com>
  Date:   2021-08-10 (Tue, 10 Aug 2021)

  Changed paths:
    M clang/docs/UsersManual.rst
    M clang/lib/Driver/ToolChains/Fuchsia.cpp
    M clang/lib/Driver/ToolChains/Fuchsia.h
    M clang/test/Driver/fuchsia.c
    M llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
    M llvm/test/Instrumentation/InstrProfiling/profiling.ll

  Log Message:
  -----------
  [InstrProfiling] Generate runtime hook for Fuchsia

When none of the translation units in the binary have been instrumented
we shouldn't need to link the profile runtime. However, because we pass
-u__llvm_profile_runtime on Linux and Fuchsia, the runtime would still
be pulled in and incur some overhead. On Fuchsia which uses runtime
counter relocation, it also means that we cannot reference the bias
variable unconditionally.

This change modifies the InstrProfiling pass to pull in the profile
runtime only when needed by declaring the __llvm_profile_runtime symbol
in the translation unit only when needed. For now we restrict this only
for Fuchsia, but this can be later expanded to other platforms. This
approach was already used prior to 9a041a75221ca, but we changed it
to always generate the __llvm_profile_runtime due to a TAPI limitation,
but that limitation may no longer apply, and it certainly doesn't apply
on platforms like Fuchsia.

Differential Revision: https://reviews.llvm.org/D98061


Compare: https://github.com/llvm/llvm-project/compare/97e41c004ca0...389dc94d4be7


More information about the All-commits mailing list