[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp

Chris Lattner sabre at nondot.org
Sat Feb 10 00:30:45 PST 2007



Changes in directory llvm/lib/VMCore:

Verifier.cpp updated: 1.192 -> 1.193
---
Log message:

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


---
Diffs of the changes:  (+5 -2)

 Verifier.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.192 llvm/lib/VMCore/Verifier.cpp:1.193
--- llvm/lib/VMCore/Verifier.cpp:1.192	Sat Feb 10 02:19:44 2007
+++ llvm/lib/VMCore/Verifier.cpp	Sat Feb 10 02:30:29 2007
@@ -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::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);
 }






More information about the llvm-commits mailing list