Return a copy of the specified function and add it to its module.
Synopsis
Declared in <llvm/Transforms/Utils/Cloning.h>
Function*
CloneFunction(
Function* F,
ValueToValueMapTy& VMap,
ClonedCodeInfo* CodeInfo = nullptr);
Description
Also, any references specified in the VMap are changed to refer to their mapped value instead of the original one. If any of the arguments to the function are in the VMap, the arguments are deleted from the resultant function. The VMap is updated to include mappings from all of the instructions and basicblocks in the function from their old to new values. The final argument captures information about the cloned code if non‐null.
Return Value
The newly cloned function, added to F's module.
Parameters
Name |
Description |
F |
Function to clone. |
VMap |
Mapping of values to rematerialize in the clone; updated with new instruction and basic‐block mappings. |
CodeInfo |
Optional collector for statistics about the cloned code. |
Preconditions
-
VMap contains no non‐identity GlobalValue mappings.
Created with MrDocs