Skip to content

Commit

Permalink
Fix assertion of null pointer samples in inline replay mode (#99378)
Browse files Browse the repository at this point in the history
Summary:
Fix #97108. In inline replay
mode, `CalleeSamples` may be null and the order doesn't matter.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250889
  • Loading branch information
wlei-llvm authored and yuxuanchen1997 committed Jul 25, 2024
1 parent 94b08e0 commit 2493286
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llvm/lib/Transforms/IPO/SampleProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 LCS;

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

0 comments on commit 2493286

Please sign in to comment.