diff options
author | Chris Lattner <sabre@nondot.org> | 2001-11-13 04:59:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-11-13 04:59:58 +0000 |
commit | 99ed5fb28d42eb98f92e0d45c717690eb175d2ec (patch) | |
tree | a81d8173549cbb880c1e40a5cda772e1383a1f89 /llvm/lib | |
parent | 4f8e9468cbc0b088ce7398c848d5f37432e7edd3 (diff) | |
download | bcm5719-llvm-99ed5fb28d42eb98f92e0d45c717690eb175d2ec.tar.gz bcm5719-llvm-99ed5fb28d42eb98f92e0d45c717690eb175d2ec.zip |
Minor style cleanups
llvm-svn: 1287
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/VMCore/iMemory.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/iMemory.cpp b/llvm/lib/VMCore/iMemory.cpp index cc24ca14412..e980d600d46 100644 --- a/llvm/lib/VMCore/iMemory.cpp +++ b/llvm/lib/VMCore/iMemory.cpp @@ -27,13 +27,12 @@ const Type* MemAccessInst::getIndexedType(const Type *Ptr, if (Ptr->isStructType()) { unsigned CurIDX = 0; - while (Ptr->isStructType()) { + while (const StructType *ST = dyn_cast<StructType>(Ptr)) { if (Idx.size() == CurIDX) return AllowStructLeaf ? Ptr : 0; // Can't load a whole structure!?!? if (Idx[CurIDX]->getType() != Type::UByteTy) return 0; // Illegal idx unsigned NextIdx = ((ConstPoolUInt*)Idx[CurIDX++])->getValue(); - - const StructType *ST = (const StructType *)Ptr; + if (NextIdx >= ST->getElementTypes().size()) return 0; Ptr = ST->getElementTypes()[NextIdx]; } return Ptr; |