[llvm] ead8586 - [InstrProfiling] Add comments for no runtime hook

Gulfem Savrun Yeniceri via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 17:28:03 PDT 2022


Author: Gulfem Savrun Yeniceri
Date: 2022-03-26T00:26:43Z
New Revision: ead8586645f54de16cfc6fa26028d818efc425f2

URL: https://github.com/llvm/llvm-project/commit/ead8586645f54de16cfc6fa26028d818efc425f2
DIFF: https://github.com/llvm/llvm-project/commit/ead8586645f54de16cfc6fa26028d818efc425f2.diff

LOG: [InstrProfiling] Add comments for no runtime hook

This patch adds comments about c7f91e227a79, and
follows LLVM style guideline about nested if statements.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index a8b013b6f2e6a..219ef12258f89 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -562,13 +562,15 @@ bool InstrProfiling::run(
   if (NeedsRuntimeHook)
     MadeChange = emitRuntimeHook();
 
-  // Improve compile time by avoiding linear scans when there is no work.
   GlobalVariable *CoverageNamesVar =
       M.getNamedGlobal(getCoverageUnusedNamesVarName());
-  if (!containsProfilingIntrinsics(M)) {
-    if (!CoverageNamesVar || !NeedsRuntimeHook) {
-      return MadeChange;
-    }
+  // 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)) {
+    return MadeChange;
   }
 
   // We did not know how many value sites there would be inside


        


More information about the llvm-commits mailing list