[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 22:28:35 PDT 2024


================
@@ -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;
----------------
WenleiHe wrote:

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..

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


More information about the llvm-commits mailing list