aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/iMemory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/iMemory.cpp')
-rw-r--r--lib/VMCore/iMemory.cpp7
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)) {