[PATCH] D134841: [InstrProfiling] Fix emitting runtime hook once

Gulfem Savrun Yeniceri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 18:21:58 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5bdf22e743db: [InstrProfiling] Fix emitting runtime hook once (authored by gulfem).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134841/new/

https://reviews.llvm.org/D134841

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
@@ -529,10 +529,11 @@
   if (NeedsRuntimeHook)
     MadeChange = emitRuntimeHook();
 
-  // Improve compile time by avoiding linear scans when there is no work.
+  bool ContainsProfiling = containsProfilingIntrinsics(M);
   GlobalVariable *CoverageNamesVar =
       M.getNamedGlobal(getCoverageUnusedNamesVarName());
-  if (!containsProfilingIntrinsics(M) && !CoverageNamesVar)
+  // Improve compile time by avoiding linear scans when there is no work.
+  if (!ContainsProfiling && !CoverageNamesVar)
     return MadeChange;
 
   // We did not know how many value sites there would be inside
@@ -571,7 +572,7 @@
   // 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))
+  if (!NeedsRuntimeHook && ContainsProfiling)
     emitRuntimeHook();
 
   emitRegistration();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134841.463735.patch
Type: text/x-patch
Size: 1188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220929/3c7cca18/attachment.bin>


More information about the llvm-commits mailing list