ΒΆvoid CloneAndPruneFunctionInto(
    llvm::Function* NewFunc,
    const llvm::Function* OldFunc,
    llvm::ValueToValueMapTy& VMap,
    bool ModuleLevelChanges,
    SmallVectorImpl<llvm::ReturnInst*>& Returns,
    const char* NameSuffix = "",
    llvm::ClonedCodeInfo* CodeInfo = nullptr,
    llvm::Instruction* TheCall = nullptr)

Description

This works exactly like CloneFunctionInto, except that it does some simple constant prop and DCE on the fly. The effect of this is to copy significantly less code in cases where (for example) a function call with constant arguments is inlined, and those constant arguments cause a significant amount of code in the callee to be dead. Since this doesn't produce an exactly copy of the input, it can't be used for things like CloneFunction or CloneModule. If ModuleLevelChanges is false, VMap contains no non-identity GlobalValue mappings.

Declared at: llvm/include/llvm/Transforms/Utils/Cloning.h:164

Parameters

llvm::Function* NewFunc
const llvm::Function* OldFunc
llvm::ValueToValueMapTy& VMap
bool ModuleLevelChanges
SmallVectorImpl<llvm::ReturnInst*>& Returns
const char* NameSuffix = ""
llvm::ClonedCodeInfo* CodeInfo = nullptr
llvm::Instruction* TheCall = nullptr