diff options
author | Chris Lattner <sabre@nondot.org> | 2002-11-19 22:54:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-11-19 22:54:01 +0000 |
commit | d18015599cbe09dd327b5f73501581a865bf27da (patch) | |
tree | e79c4792f7ce0bd99b129e0f7df07e8994d34d21 /lib/Transforms/IPO/InlineSimple.cpp | |
parent | 6c2e2e52870230838380778415d9ad543e66dae3 (diff) |
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/IPO/InlineSimple.cpp')
-rw-r--r-- | lib/Transforms/IPO/InlineSimple.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index b4542ead3e..6dbab594e8 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -90,9 +90,14 @@ bool InlineFunction(CallInst *CI) { Function::iterator LastBlock = &OrigBB->getParent()->back(); // Calculate the vector of arguments to pass into the function cloner... - std::vector<Value*> ArgVector; - for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i) - ArgVector.push_back(CI->getOperand(i)); + std::map<const Value*, Value*> ValueMap; + assert((unsigned)std::distance(CalledFunc->abegin(), CalledFunc->aend()) == + CI->getNumOperands()-1 && "No varargs calls can be inlined yet!"); + + unsigned i = 1; + for (Function::const_aiterator I = CalledFunc->abegin(), E=CalledFunc->aend(); + I != E; ++I, ++i) + ValueMap[I] = CI->getOperand(i); // Since we are now done with the CallInst, we can delete it. delete CI; @@ -101,7 +106,7 @@ bool InlineFunction(CallInst *CI) { std::vector<ReturnInst*> Returns; // Do all of the hard part of cloning the callee into the caller... - CloneFunctionInto(OrigBB->getParent(), CalledFunc, ArgVector, Returns, ".i"); + CloneFunctionInto(OrigBB->getParent(), CalledFunc, ValueMap, Returns, ".i"); // Loop over all of the return instructions, turning them into unconditional // branches to the merge point now... |