[llvm] [PGO] Preserve analysis results when nothing was instrumented (PR #93421)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 14:20:18 PDT 2024


================
@@ -1845,14 +1845,19 @@ static bool InstrumentAllFunctions(
   std::unordered_multimap<Comdat *, GlobalValue *> ComdatMembers;
   collectComdatMembers(M, ComdatMembers);
 
+  bool AnythingInstrumented = false;
   for (auto &F : M) {
     if (skipPGOGen(F))
       continue;
     auto &TLI = LookupTLI(F);
     auto *BPI = LookupBPI(F);
     auto *BFI = LookupBFI(F);
     instrumentOneFunc(F, &M, TLI, BPI, BFI, ComdatMembers, IsCS);
+    AnythingInstrumented = true;
   }
+  if (!AnythingInstrumented)
+    return false;
+
   return true;
----------------
ellishg wrote:

```suggestion
  return AnythingInstrumented;
```

https://github.com/llvm/llvm-project/pull/93421


More information about the llvm-commits mailing list