avoid dividing by zero when dealing with zero sized types (like [0 x double])


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6862 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp
index 7aa5564..c8e5ecc 100644
--- a/lib/Transforms/TransformInternals.cpp
+++ b/lib/Transforms/TransformInternals.cpp
@@ -119,6 +119,7 @@
       if (!ElTy->isSized() || (isa<PointerType>(CompTy) && !Indices.empty()))
         return 0; // Type is unreasonable... escape!
       unsigned ElSize = TD.getTypeSize(ElTy);
+      if (ElSize == 0) return 0;   // Avoid division by zero...
       int64_t ElSizeS = ElSize;
 
       // See if the user is indexing into a different cell of this array...