speed up the verifier 8.5% by using a smallvector instead of vector.

llvm-svn: 34144
This commit is contained in:
Chris Lattner 2007-02-10 08:30:29 +00:00
parent bc97cc29e7
commit 84d82c7e98
1 changed files with 5 additions and 2 deletions

View File

@ -57,6 +57,7 @@
#include "llvm/Support/InstVisitor.h"
#include "llvm/Support/Streams.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Compiler.h"
@ -809,11 +810,13 @@ void Verifier::visitShuffleVectorInst(ShuffleVectorInst &SV) {
}
void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) {
SmallVector<Value*, 16> Idxs(GEP.idx_begin(), GEP.idx_end());
const Type *ElTy =
GetElementPtrInst::getIndexedType(GEP.getOperand(0)->getType(),
std::vector<Value*>(GEP.idx_begin(), GEP.idx_end()), true);
&Idxs[0], Idxs.size(), true);
Assert1(ElTy, "Invalid indices for GEP pointer type!", &GEP);
Assert2(PointerType::get(ElTy) == GEP.getType(),
Assert2(isa<PointerType>(GEP.getType()) &&
cast<PointerType>(GEP.getType())->getElementType() == ElTy,
"GEP is not of right type for indices!", &GEP, ElTy);
visitInstruction(GEP);
}