llvm-project
d42c701d - [SampleProfile] Ignore unsampled callees in profile anchors (#219335)

Commit
70 days ago
[SampleProfile] Ignore unsampled callees in profile anchors (#219335) Sample profiles can retain zero-count callee entries in both flattened body call targets and unflattened callsite samples: ```text probe 12: foo: 10 cleanup: 0 ``` Counting every entry as a distinct callee converts the uniquely sampled foo callsite into UnknownIndirectCallee. It then fails to match the direct IR call to foo, causing valid samples to be reported as stale. Ignore zero-count entries when the same location has a sampled callee. Preserve the existing behavior for genuine multi-callee sites and locations where every callee has zero samples. ```text foo: 10, cleanup: 0 -> foo foo: 10, bar: 1 -> UnknownIndirectCallee foo: 0, cleanup: 0 -> unchanged ``` The change covers both: - flattened call targets from body samples; - inline callees from unflattened callsite samples. ## Related fixes This is downstream profile-matching robustness related to #219079. Those changes prevent invalid pseudo-probe context earlier in the pipeline. This change ensures that any zero-sample entries reaching the profile matcher are not treated as evidence of another executed callee. ## Tests Added regression coverage for zero-sample callees, genuine multiple sampled callees, flattened body targets, and unflattened callsite samples. Assisted by: Claude
Author
Parents
Loading