Fix bug: LevelRaise/2003-01-22-GEPProblem.ll
authorChris Lattner <sabre@nondot.org>
Thu, 23 Jan 2003 02:39:10 +0000 (02:39 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 23 Jan 2003 02:39:10 +0000 (02:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5407 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/TransformInternals.cpp

index 51d5ff54c2b741fb6d72b5498997addb7a59782f..62953f8c6d08a8b52c649b0f3dd1a1db3b5971f1 100644 (file)
@@ -120,7 +120,7 @@ const Type *ConvertableToGEP(const Type *Ty, Value *OffsetVal,
       Offset -= ActualOffset;
     } else {
       const Type *ElTy = cast<SequentialType>(CompTy)->getElementType();
-      if (!ElTy->isSized())
+      if (!ElTy->isSized() || (isa<PointerType>(CompTy) && !Indices.empty()))
         return 0; // Type is unreasonable... escape!
       unsigned ElSize = TD.getTypeSize(ElTy);
       int64_t ElSizeS = ElSize;