summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-11-19 22:54:01 +0000
committerChris Lattner <sabre@nondot.org>2002-11-19 22:54:01 +0000
commitd18015599cbe09dd327b5f73501581a865bf27da (patch)
treee79c4792f7ce0bd99b129e0f7df07e8994d34d21 /lib/Transforms/Utils/CloneFunction.cpp
parent6c2e2e52870230838380778415d9ad543e66dae3 (diff)
downloadllvm-d18015599cbe09dd327b5f73501581a865bf27da.tar.gz
llvm-d18015599cbe09dd327b5f73501581a865bf27da.tar.bz2
llvm-d18015599cbe09dd327b5f73501581a865bf27da.tar.xz
Minor changes to cloning interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4770 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 442ff03df3..36b3a7e701 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -37,25 +37,16 @@ static inline void RemapInstruction(Instruction *I,
// ArgMap values.
//
void CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
- const std::vector<Value*> &ArgMap,
+ std::map<const Value*, Value*> &ValueMap,
std::vector<ReturnInst*> &Returns,
const char *NameSuffix) {
assert(NameSuffix && "NameSuffix cannot be null!");
- assert(OldFunc->asize() == ArgMap.size() &&
- "Improper number of argument values to map specified!");
- // Keep a mapping between the original function's values and the new
- // duplicated code's values. This includes all of: Function arguments,
- // instruction values, constant pool entries, and basic blocks.
- //
- std::map<const Value *, Value*> ValueMap;
-
- // Add all of the function arguments to the mapping...
- unsigned i = 0;
+#ifndef NDEBUG
for (Function::const_aiterator I = OldFunc->abegin(), E = OldFunc->aend();
- I != E; ++I, ++i)
- ValueMap[I] = ArgMap[i];
-
+ I != E; ++I)
+ assert(ValueMap.count(I) && "No mapping from source argument specified!");
+#endif
// Loop over all of the basic blocks in the function, cloning them as
// appropriate. Note that we save BE this way in order to handle cloning of