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

Chris Lattner lattner at cs.uiuc.edu
Mon Jun 2 00:22:02 PDT 2003


Changes in directory llvm/lib/Target:

TargetData.cpp updated: 1.32 -> 1.33

---
Log message:

Minor cleanups


---
Diffs of the changes:

Index: llvm/lib/Target/TargetData.cpp
diff -u llvm/lib/Target/TargetData.cpp:1.32 llvm/lib/Target/TargetData.cpp:1.33
--- llvm/lib/Target/TargetData.cpp:1.32	Wed May 21 13:08:44 2003
+++ llvm/lib/Target/TargetData.cpp	Mon Jun  2 00:21:06 2003
@@ -195,10 +195,10 @@
       // Get the array index and the size of each array element.
       // Both must be known constants, or the index shd be 0; else this fails.
       int64_t arrayIdx = cast<ConstantSInt>(Idx[CurIDX])->getValue();
-      Result += arrayIdx == 0? 0
-                : (uint64_t) (arrayIdx * (int64_t) getTypeSize(Ty)); 
+      Result += arrayIdx * (int64_t)getTypeSize(Ty);
 
-    } else if (const StructType *STy = dyn_cast<const StructType>(Ty)) {
+    } else {
+      const StructType *STy = cast<StructType>(Ty);
       assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx");
       unsigned FieldNo = cast<ConstantUInt>(Idx[CurIDX])->getValue();
 
@@ -211,9 +211,6 @@
 
       // Update Ty to refer to current element
       Ty = STy->getElementTypes()[FieldNo];
-    } else {
-      assert(0 && "Indexing type that is not struct or array?");
-      return 0;                         // Load directly through ptr
     }
   }
 





More information about the llvm-commits mailing list