[llvm] [CSSPGO] Fix the issue of missing callee profile matches (PR #85715)
Lei Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 20:53:48 PDT 2024
================
@@ -126,17 +129,16 @@ class PseudoProbeManager {
bool profileIsValid(const Function &F, const FunctionSamples &Samples) const {
const auto *Desc = getDesc(F);
- if (!Desc) {
- LLVM_DEBUG(dbgs() << "Probe descriptor missing for Function "
- << F.getName() << "\n");
- return false;
- }
- if (Desc->getFunctionHash() != Samples.getFunctionHash()) {
- LLVM_DEBUG(dbgs() << "Hash mismatch for Function " << F.getName()
- << "\n");
- return false;
- }
- return true;
+ assert(!(LTOPhase == ThinOrFullLTOPhase::ThinLTOPostLink && Desc &&
----------------
wlei-llvm wrote:
> nit: i found it easier to parse/read if we change it to:
>
> skip for pre-link or if we don't have desc, otherwise for post-link with desc, we expect attribute to match desc `assert(LTOPhase != ThinOrFullLTOPhase::ThinLTOPostLink || !Desc || profileIsHashMismatched(*Desc, Samples) == F.hasFnAttribute("profile-checksum-mismatch") && "...")`
Good point, thanks!
https://github.com/llvm/llvm-project/pull/85715
More information about the llvm-commits
mailing list