aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-04 21:44:26 +0000
committerChris Lattner <sabre@nondot.org>2004-02-04 21:44:26 +0000
commita33ceaa2d46f6bf50c979e28581d9e4941b45d44 (patch)
tree276901095c87826337731dc726f7941819bb4086 /lib
parent7a45c49344a4cfd9f24a8aaf8351d6bfe981346a (diff)
downloadexternal_llvm-a33ceaa2d46f6bf50c979e28581d9e4941b45d44.zip
external_llvm-a33ceaa2d46f6bf50c979e28581d9e4941b45d44.tar.gz
external_llvm-a33ceaa2d46f6bf50c979e28581d9e4941b45d44.tar.bz2
Minor speedup, don't query ValueMap each time through the loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11123 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 4aa1aaa..f5ea660 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/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