diff options
author | Chris Lattner <sabre@nondot.org> | 2007-01-31 19:56:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-01-31 19:56:15 +0000 |
commit | 4c3d3a99d5b667e1ea8b8e9a12525f5d168795e3 (patch) | |
tree | bf863e72aa1e82ddbfcd88d4693f210875b73bd9 /lib/Bytecode/Reader/Reader.cpp | |
parent | 95b9d6e5d8f35ccefccea0680ed733e752ff7d65 (diff) |
eliminate a temporary vector while parsing gep's from bc files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 3c72d639e0..c649a3b19c 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -30,6 +30,7 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/Compressor.h" #include "llvm/Support/MathExtras.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include <sstream> #include <algorithm> @@ -799,7 +800,7 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds, if (Oprnds.size() == 0 || !isa<PointerType>(InstTy)) error("Invalid getelementptr instruction!"); - std::vector<Value*> Idx; + SmallVector<Value*, 8> Idx; const Type *NextTy = InstTy; for (unsigned i = 1, e = Oprnds.size(); i != e; ++i) { @@ -823,10 +824,12 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds, ValIdx >>= 1; } Idx.push_back(getValue(IdxTy, ValIdx)); - NextTy = GetElementPtrInst::getIndexedType(InstTy, Idx, true); + NextTy = GetElementPtrInst::getIndexedType(InstTy, &Idx[0], Idx.size(), + true); } - Result = new GetElementPtrInst(getValue(iType, Oprnds[0]), Idx); + Result = new GetElementPtrInst(getValue(iType, Oprnds[0]), + &Idx[0], Idx.size()); break; } case 62: // volatile load |