[#llvm-pgo-promoteIndirectCall] = xref:llvm.adoc[llvm]::xref:llvm/pgo.adoc[pgo]::promoteIndirectCall :relfileprefix: ../../ :mrdocs: Promote an indirect call or invoke `CB` to a conditional direct call to `F.` == Synopsis Declared in `<llvm/Transforms/Utils/Instrumentation.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:llvm/CallBase.adoc[CallBase]& promoteIndirectCall( xref:llvm/CallBase.adoc[CallBase]& CB, xref:llvm/Function.adoc[Function]* F, uint64_t Count, uint64_t TotalCount, bool AttachProfToDirectCall, xref:llvm/OptimizationRemarkEmitter.adoc[OptimizationRemarkEmitter]* ORE); ---- == Description Transforms `CB` (an indirect‐call or invoke) into the equivalent of: if (Inst.CalledValue == F) F(...); else Inst(...); `TotalCount` is the profile count value that the instruction executes. `Count` is the profile count value that `F` is the target function. These two values are used to update the branch weight. If `AttachProfToDirectCall` is true, a prof metadata is attached to the new direct call to contain `Count.` == Return Value The promoted direct call instruction. == Parameters [cols="1,4"] |=== | Name| Description | *CB* | Indirect call or invoke to promote. | *F* | Hot callee to test for and call directly. | *Count* | Profile count of calls from `CB` that target `F.` | *TotalCount* | Profile count of all executions of `CB.` | *AttachProfToDirectCall* | Whether to attach `!prof` with `Count` to the new direct call. | *ORE* | Optional remark emitter for promotion diagnostics. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#