[llvm] [SampleProf] Check probe-based profile in isProfileUnused (PR #190852)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 13:53:25 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-pgo

Author: Wei Wang (apolloww)

<details>
<summary>Changes</summary>

`ProbeManager` is only initialized for probe based profile. Add proper check in isProfileUnused

---
Full diff: https://github.com/llvm/llvm-project/pull/190852.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp (+1) 


``````````diff
diff --git a/llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp b/llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp
index ae5cc30917496..b3199e38d5e3f 100644
--- a/llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp
@@ -187,6 +187,7 @@ bool SampleProfileMatcher::isProfileUnused(const FunctionId &ProfileFuncName) {
   // module. Check if the function name exists in the pseudo_probe descriptors.
   return (SymbolMap->find(ProfileFuncName) == SymbolMap->end()) &&
          (LTOPhase == ThinOrFullLTOPhase::ThinLTOPreLink ||
+          !FunctionSamples::ProfileIsProbeBased ||
           !ProfileFuncName.isStringRef() ||
           (ProbeManager->getDesc(ProfileFuncName.stringRef()) == nullptr));
 }

``````````

</details>


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


More information about the llvm-commits mailing list