[PATCH] D134254: [InstrProfiling] Emit runtime hook only once

Gulfem Savrun Yeniceri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 20:28:20 PDT 2022


gulfem created this revision.
Herald added subscribers: Enna1, ellis, hiraditya.
Herald added a project: All.
gulfem requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch fixes the issue about calling emitRuntimeHook() twice
when we need to unconditionally emit runtime hook as discussed in
https://reviews.llvm.org/rGd6aed77f0d19.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134254

Files:
  llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp


Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -567,11 +567,11 @@
   emitVNodes();
   emitNameData();
 
-  // Emit runtime hook except for the cases where 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.
-  if (containsProfilingIntrinsics(M) || !CoverageNamesVar || NeedsRuntimeHook)
+  // Emit runtime hook for the cases where the target does not unconditionally
+  // require pulling in profile runtime, and coverage is enabled on code that is
+  // not eliminated by the front-end, e.g. unused functions with internal
+  // linkage.
+  if (!NeedsRuntimeHook && containsProfilingIntrinsics(M))
     emitRuntimeHook();
 
   emitRegistration();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134254.461459.patch
Type: text/x-patch
Size: 988 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220920/96321529/attachment.bin>


More information about the llvm-commits mailing list