This is similar to promoteCallWithIfThenElse except that the condition to promote a virtual call is that VPtr is the same as any of AddressPoints.
Synopsis
Declared in <llvm/Transforms/Utils/CallPromotionUtils.h>
CallBase&
promoteCallWithVTableCmp(
CallBase& CB,
Instruction* VPtr,
Function* Callee,
ArrayRef<Constant*> AddressPoints,
MDNode* BranchWeights);
Description
This function is expected to be used on virtual calls (a subset of indirect calls). VPtr is the virtual table address stored in the objects, and AddressPoints contains vtable address points. A vtable address point is a location inside the vtable that's referenced by vpointer in C++ objects.
TODO: sink the address‐calculation instructions of indirect callee to the indirect call fallback after transformation.
Return Value
The promoted direct call placed in the "then" block.
Parameters
Name |
Description |
CB |
Virtual call site to promote conditionally. |
VPtr |
Virtual table pointer compared against the address points. |
Callee |
Function to call on the promoted path. |
AddressPoints |
Vtable address points that identify the promoted type. |
BranchWeights |
Optional !prof metadata for the new conditional branch. |
Created with MrDocs