-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix assertion of null pointer samples in inline replay mode #99378
Conversation
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-pgo Author: Lei Wang (wlei-llvm) ChangesFix #97108. In inline replay mode, Full diff: https://github.com/llvm/llvm-project/pull/99378.diff 1 Files Affected:
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())
|
// In inline replay mode, CalleeSamples may be null and the order doesn't | ||
// matter. | ||
if (!LCS || !RCS) | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should give a deterministic order when only one side is null. With the current change, "non-null" vs "null" and "null" vs "non-null" both are false..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks.
Fix llvm#97108. In inline replay mode, `CalleeSamples` may be null and the order doesn't matter.
Fix llvm#97108. In inline replay mode, `CalleeSamples` may be null and the order doesn't matter.
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
Fix #97108. In inline replay mode,
CalleeSamples
may be null and the order doesn't matter.