[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jun 3 21:36:01 PDT 2003


Changes in directory llvm/lib/Target:

TargetData.cpp updated: 1.34 -> 1.35

---
Log message:

No really, you _cannot use_ getelementptr on an unsized type: that makes 
no sense.


---
Diffs of the changes:

Index: llvm/lib/Target/TargetData.cpp
diff -u llvm/lib/Target/TargetData.cpp:1.34 llvm/lib/Target/TargetData.cpp:1.35
--- llvm/lib/Target/TargetData.cpp:1.34	Tue Jun  3 21:10:37 2003
+++ llvm/lib/Target/TargetData.cpp	Tue Jun  3 21:35:35 2003
@@ -193,12 +193,8 @@
       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");





More information about the llvm-commits mailing list