diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-04 01:19:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-04 01:19:43 +0000 |
commit | 23b4c68f465373f5c82551e42725af5dc150221f (patch) | |
tree | 51ae08cb4c2bdc3cb276b92e63defa01e9a26028 /lib/Transforms/Utils/CloneFunction.cpp | |
parent | 786993c01ec8bdabe354fb62a083fedc9d7a087e (diff) |
Give CloneBasicBlock an optional function argument to specify which function
to add the cloned block to. This allows the block to be added to the function
immediately, and all of the instructions to be immediately added to the function
symbol table, which speeds up the inliner from 3.7 -> 3.38s on the PR209.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r-- | lib/Transforms/Utils/CloneFunction.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index 17ad8c5175..4aa1aaa0d2 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/lib/Transforms/Utils/CloneFunction.cpp @@ -42,8 +42,8 @@ static inline void RemapInstruction(Instruction *I, // CloneBasicBlock - See comments in Cloning.h BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB, std::map<const Value*, Value*> &ValueMap, - const char *NameSuffix) { - BasicBlock *NewBB = new BasicBlock(""); + const char *NameSuffix, Function *F) { + BasicBlock *NewBB = new BasicBlock("", F); if (BB->hasName()) NewBB->setName(BB->getName()+NameSuffix); // Loop over all instructions copying them over... @@ -82,8 +82,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, const BasicBlock &BB = *BI; // Create a new basic block and copy instructions into it! - BasicBlock *CBB = CloneBasicBlock(&BB, ValueMap, NameSuffix); - NewFunc->getBasicBlockList().push_back(CBB); + BasicBlock *CBB = CloneBasicBlock(&BB, ValueMap, NameSuffix, NewFunc); ValueMap[&BB] = CBB; // Add basic block mapping. if (ReturnInst *RI = dyn_cast<ReturnInst>(CBB->getTerminator())) |