[llvm] Fix assertion of null pointer samples in inline replay mode (PR #99378)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 12:24:31 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-pgo
Author: Lei Wang (wlei-llvm)
<details>
<summary>Changes</summary>
Fix https://github.com/llvm/llvm-project/issues/97108. In inline replay mode, `CalleeSamples` may be null and the order doesn't matter.
---
Full diff: https://github.com/llvm/llvm-project/pull/99378.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/IPO/SampleProfile.cpp (+4-1)
``````````diff
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 5cc2911a1a80e..b43fde3d4e086 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -439,7 +439,10 @@ struct CandidateComparer {
const FunctionSamples *LCS = LHS.CalleeSamples;
const FunctionSamples *RCS = RHS.CalleeSamples;
- assert(LCS && RCS && "Expect non-null FunctionSamples");
+ // In inline replay mode, CalleeSamples may be null and the order doesn't
+ // matter.
+ if (!LCS || !RCS)
+ return false;
// Tie breaker using number of samples try to favor smaller functions first
if (LCS->getBodySamples().size() != RCS->getBodySamples().size())
``````````
</details>
https://github.com/llvm/llvm-project/pull/99378
More information about the llvm-commits
mailing list