diff options
author | Chris Lattner <sabre@nondot.org> | 2004-04-05 01:30:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-04-05 01:30:19 +0000 |
commit | 28977af72a11fcad5d1b54d7a96b3df02828f6fc (patch) | |
tree | 671a8fa4df839cb653ebd22dda8fa39639b3afa7 /lib/VMCore/iMemory.cpp | |
parent | 830b6f98686f40f86811dceb5497433ebac385e1 (diff) |
Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/iMemory.cpp')
-rw-r--r-- | lib/VMCore/iMemory.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/VMCore/iMemory.cpp b/lib/VMCore/iMemory.cpp index 7c8f66599f..1fc1df8c95 100644 --- a/lib/VMCore/iMemory.cpp +++ b/lib/VMCore/iMemory.cpp @@ -137,7 +137,12 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr, if (!isa<PointerType>(Ptr)) return 0; // Type isn't a pointer type! // Handle the special case of the empty set index set... - if (Idx.empty()) return cast<PointerType>(Ptr)->getElementType(); + if (Idx.empty()) + if (AllowCompositeLeaf || + cast<PointerType>(Ptr)->getElementType()->isFirstClassType()) + return cast<PointerType>(Ptr)->getElementType(); + else + return 0; unsigned CurIdx = 0; while (const CompositeType *CT = dyn_cast<CompositeType>(Ptr)) { |