diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-04 02:35:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-04 02:35:35 +0000 |
commit | 94a511867214e9f72f96ab3cce277b8a175f3f1d (patch) | |
tree | a7c50c053376c38bcef21e6e07b12d53f2070437 /lib/Target/TargetData.cpp | |
parent | 9dc3ede509c9dbe76ff123d280f31b011467ed08 (diff) |
No really, you _cannot use_ getelementptr on an unsized type: that makes
no sense.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6595 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetData.cpp')
-rw-r--r-- | lib/Target/TargetData.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index bdeb4e99c6..8aa1851a18 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -193,12 +193,8 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy, Ty = cast<SequentialType>(Ty)->getElementType(); // Get the array index and the size of each array element. - // The size must be a known value, except if arrayIdx is 0. - // In particular, don't try to get the type size if the arrayIdx is 0: - // 0 index into an unsized type is legal and should be allowed. int64_t arrayIdx = cast<ConstantSInt>(Idx[CurIDX])->getValue(); - Result += arrayIdx == 0? 0 - : arrayIdx * (int64_t)getTypeSize(Ty); + Result += arrayIdx * (int64_t)getTypeSize(Ty); } else { const StructType *STy = cast<StructType>(Ty); assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx"); |