[llvm] [SampleProfile] Ignore unsampled callees in profile anchors (PR #219335)

Kunal Pathak via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 17:03:13 PDT 2026


kunalspathak wrote:

> `UnknownIndirectCallee` is the special ID for indirect call in both the IR and profile sides. By dropping zero sampled call targets, an indirect call in the profile can be viewed as direct call. Would this cause unnecessary mismatch against an IR indirect call?

Yes, good catch. The original version could reduce `foo:N, unsampled:0` to `foo` and then incorrectly mismatch it against `UnknownIndirectCallee` on the IR side. I changed anchor matching to be asymmetric. An IR `UnknownIndirectCallee` is compatible with any profiled callee because its target is not statically known. A direct IR call still requires a matching callee and does not match a profile-side `UnknownIndirectCallee`.

The regression test now covers both direct and indirect IR calls with the same sampled-plus-zero-count profile shape.

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


More information about the llvm-commits mailing list