Skip to content

Commit ce8c43f

Browse files
authored
Fix assertion of null pointer samples in inline replay mode (#99378)
Fix #97108. In inline replay mode, `CalleeSamples` may be null and the order doesn't matter.
1 parent 1c55586 commit ce8c43f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/Transforms/IPO/SampleProfile.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,10 @@ struct CandidateComparer {
439439

440440
const FunctionSamples *LCS = LHS.CalleeSamples;
441441
const FunctionSamples *RCS = RHS.CalleeSamples;
442-
assert(LCS && RCS && "Expect non-null FunctionSamples");
442+
// In inline replay mode, CalleeSamples may be null and the order doesn't
443+
// matter.
444+
if (!LCS || !RCS)
445+
return LCS;
443446

444447
// Tie breaker using number of samples try to favor smaller functions first
445448
if (LCS->getBodySamples().size() != RCS->getBodySamples().size())

0 commit comments

Comments
 (0)