diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-04 21:44:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-04 21:44:26 +0000 |
commit | 39ad6f2772684cffca3d636c06b2d6e3830bdf8e (patch) | |
tree | 3a547fb93d5b0093736c5aa193321a29b67d6075 /llvm/lib/Transforms/Utils/CloneFunction.cpp | |
parent | fe6623986035b82e730165735e6f1eeecb7a8ac0 (diff) | |
download | bcm5719-llvm-39ad6f2772684cffca3d636c06b2d6e3830bdf8e.tar.gz bcm5719-llvm-39ad6f2772684cffca3d636c06b2d6e3830bdf8e.zip |
Minor speedup, don't query ValueMap each time through the loop
llvm-svn: 11123
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 4aa1aaa0d28..f5ea66047a1 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -92,14 +92,11 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, // Loop over all of the instructions in the function, fixing up operand // references as we go. This uses ValueMap to do all the hard work. // - for (Function::const_iterator BB = OldFunc->begin(), BE = OldFunc->end(); - BB != BE; ++BB) { - BasicBlock *NBB = cast<BasicBlock>(ValueMap[BB]); - + for (Function::iterator BB = cast<BasicBlock>(ValueMap[OldFunc->begin()]), + BE = NewFunc->end(); BB != BE; ++BB) // Loop over all instructions, fixing each one as we find it... - for (BasicBlock::iterator II = NBB->begin(); II != NBB->end(); ++II) + for (BasicBlock::iterator II = BB->begin(); II != BB->end(); ++II) RemapInstruction(II, ValueMap); - } } /// CloneFunction - Return a copy of the specified function, but without |