[clang] bcf8f21 - Revert "[InstrProfiling] No runtime hook for unused funcs"
Gulfem Savrun Yeniceri via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 5 18:43:21 PDT 2022
Author: Gulfem Savrun Yeniceri
Date: 2022-04-06T01:41:44Z
New Revision: bcf8f2188bd53b2874bcd142960d22f3334e2051
URL: https://github.com/llvm/llvm-project/commit/bcf8f2188bd53b2874bcd142960d22f3334e2051
DIFF: https://github.com/llvm/llvm-project/commit/bcf8f2188bd53b2874bcd142960d22f3334e2051.diff
LOG: Revert "[InstrProfiling] No runtime hook for unused funcs"
This reverts commit c7f91e227a799dfee05962bb108274dbfe809fee.
This patch caused an issue in Fuchsia source code coverage builders.
Added:
Modified:
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
Removed:
clang/test/CoverageMapping/unused_function_no_runtime_hook.cpp
################################################################################
diff --git a/clang/test/CoverageMapping/unused_function_no_runtime_hook.cpp b/clang/test/CoverageMapping/unused_function_no_runtime_hook.cpp
deleted file mode 100644
index 5a835ae311697..0000000000000
--- a/clang/test/CoverageMapping/unused_function_no_runtime_hook.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-// RUN: %clang -target x86_64-unknown-fuchsia -fprofile-instr-generate -fcoverage-mapping -emit-llvm -S %s -o - | FileCheck %s
-
-// CHECK-NOT: @__llvm_profile_runtime
-static int f0() {
- return 100;
-}
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 219ef12258f89..379c41ce66936 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -558,20 +558,16 @@ bool InstrProfiling::run(
TT = Triple(M.getTargetTriple());
bool MadeChange = false;
- bool NeedsRuntimeHook = needsRuntimeHookUnconditionally(TT);
- if (NeedsRuntimeHook)
+
+ // Emit the runtime hook even if no counters are present.
+ if (needsRuntimeHookUnconditionally(TT))
MadeChange = emitRuntimeHook();
+ // Improve compile time by avoiding linear scans when there is no work.
GlobalVariable *CoverageNamesVar =
M.getNamedGlobal(getCoverageUnusedNamesVarName());
- // Improve compile time by avoiding linear scans when there is no work.
- // When coverage is enabled on code that is eliminated by the front-end,
- // e.g. unused functions with internal linkage, and the target does not
- // require pulling in profile runtime, there is no need to do further work.
- if (!containsProfilingIntrinsics(M) &&
- (!CoverageNamesVar || !NeedsRuntimeHook)) {
+ if (!containsProfilingIntrinsics(M) && !CoverageNamesVar)
return MadeChange;
- }
// We did not know how many value sites there would be inside
// the instrumented function. This is counting the number of instrumented
More information about the cfe-commits
mailing list