From: Chris Lattner Date: Sat, 27 May 2006 01:21:50 +0000 (+0000) Subject: Implement a new method: CloneAndPruneFunctionInto, as documented. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f72716d81f64664e6897d9f2e8a7d071bad1de68;p=oota-llvm.git Implement a new method: CloneAndPruneFunctionInto, as documented. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28518 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h index 4560c728627..38fc5ba740d 100644 --- a/include/llvm/Transforms/Utils/Cloning.h +++ b/include/llvm/Transforms/Utils/Cloning.h @@ -130,6 +130,19 @@ void CloneFunctionInto(Function *NewFunc, const Function *OldFunc, const char *NameSuffix = "", ClonedCodeInfo *CodeInfo = 0); +/// CloneAndPruneFunctionInto - 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. +void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, + std::map &ValueMap, + std::vector &Returns, + const char *NameSuffix = "", + ClonedCodeInfo *CodeInfo = 0); + /// CloneTraceInto - Clone T into NewFunc. Original<->clone mapping is /// saved in ValueMap.