summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-04 02:35:35 +0000
committerChris Lattner <sabre@nondot.org>2003-06-04 02:35:35 +0000
commitfee44070a1d93302ce07c2f2ce946ceca03db8b8 (patch)
treedb7587bc36aebe34ea5141384de45f5530d70c8b
parent37586db4b5344def5d2172a849aafd1a2c13770a (diff)
downloadbcm5719-llvm-fee44070a1d93302ce07c2f2ce946ceca03db8b8.tar.gz
bcm5719-llvm-fee44070a1d93302ce07c2f2ce946ceca03db8b8.zip
No really, you _cannot use_ getelementptr on an unsized type: that makes
no sense. llvm-svn: 6595
-rw-r--r--llvm/lib/Target/TargetData.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp
index bdeb4e99c6a..8aa1851a181 100644
--- a/llvm/lib/Target/TargetData.cpp
+++ b/llvm/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");
OpenPOWER on IntegriCloud