mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-22 03:58:16 +00:00
eliminate a temporary vector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33695 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d917fe5692
commit
e013540654
@ -20,6 +20,7 @@
|
||||
#include "llvm/SymbolTable.h"
|
||||
#include "llvm/Support/GetElementPtrTypeIterator.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/Streams.h"
|
||||
@ -1733,7 +1734,7 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
|
||||
if (!IdxTy)
|
||||
GEN_ERROR("Index list invalid for constant getelementptr!");
|
||||
|
||||
std::vector<Constant*> IdxVec;
|
||||
SmallVector<Constant*, 8> IdxVec;
|
||||
for (unsigned i = 0, e = $4->size(); i != e; ++i)
|
||||
if (Constant *C = dyn_cast<Constant>((*$4)[i]))
|
||||
IdxVec.push_back(C);
|
||||
@ -1742,7 +1743,7 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
|
||||
|
||||
delete $4;
|
||||
|
||||
$$ = ConstantExpr::getGetElementPtr($3, IdxVec);
|
||||
$$ = ConstantExpr::getGetElementPtr($3, &IdxVec[0], IdxVec.size());
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| SELECT '(' ConstVal ',' ConstVal ',' ConstVal ')' {
|
||||
|
@ -1171,8 +1171,8 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) {
|
||||
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
|
||||
return Result;
|
||||
} else if (Opcode == Instruction::GetElementPtr) { // GetElementPtr
|
||||
std::vector<Constant*> IdxList(ArgVec.begin()+1, ArgVec.end());
|
||||
Constant *Result = ConstantExpr::getGetElementPtr(ArgVec[0], IdxList);
|
||||
Constant *Result = ConstantExpr::getGetElementPtr(ArgVec[0], &ArgVec[1],
|
||||
ArgVec.size()-1);
|
||||
if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result);
|
||||
return Result;
|
||||
} else if (Opcode == Instruction::Select) {
|
||||
|
Loading…
Reference in New Issue
Block a user