[all-commits] [llvm/llvm-project] d42c70: [SampleProfile] Ignore unsampled callees in profil...

Kunal Pathak via All-commits all-commits at lists.llvm.org
Fri Sep 11 14:34:00 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d42c701dc3d00dacff3806ea428a274aae39fed0
      https://github.com/llvm/llvm-project/commit/d42c701dc3d00dacff3806ea428a274aae39fed0
  Author: Kunal Pathak <kunalspathak at hotmail.com>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h
    M llvm/lib/Transforms/IPO/SampleProfileMatcher.cpp
    A llvm/test/Transforms/SampleProfile/Inputs/non-probe-stale-profile-indirect-call-anchor.prof
    A llvm/test/Transforms/SampleProfile/Inputs/profile-mismatch-indirect-call.prof
    A llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-profile-mismatch-multiple-sampled-callees.prof
    A llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-profile-mismatch-zero-callee.prof
    A llvm/test/Transforms/SampleProfile/non-probe-stale-profile-indirect-call-anchor.ll
    A llvm/test/Transforms/SampleProfile/profile-mismatch-indirect-call.ll
    M llvm/test/Transforms/SampleProfile/pseudo-probe-profile-mismatch.ll

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list