mirror of
https://github.com/llvm/llvm-project.git
synced 2026-10-29 14:08:35 +08:00
Add a `HasIndirectCall` flag to the summary call edge (`CalleeInfo`), set by the summary analysis when recording indirect call edges (from indirect call value profile targets, or from `!callees` metadata on indirect calls that could not be promoted/devirtualized to direct calls). If a function calls the same callee both directly and indirectly, the merged edge is marked indirect. This will be used by a follow-up MemProf ThinLTO change to distinguish indirect call edges (which require importing the target at least as a declaration for indirect call promotion in the backend when assigned to a cloned cross-module callee) from direct call edges (where the backend already has or can directly update the declaration). The flag uses a previously unused bit of the existing `CalleeInfo` bitfield (no in-memory size change), and is encoded as bit 4 of the existing per-call-edge hotness/tail call flags operand in the per-module and combined summaries. The encoded flags value is at most 31, which still fits in a single chunk of both the VBR8 abbreviation array element and the VBR6 unabbreviated encoding, so the bitcode size is unchanged. Older readers ignore the bit, and older bitcode is read as not indirect, so no summary version bump is needed. The flag is printed and parsed as `indirect: 1` in the textual summary (only emitted when set, like `tail: 1`). Assisted-by: Gemini