TargetData assumes (and some regression tests depend on it) that the size of
an unspecified datatype in the datalayout is capped by the size of a pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33411 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index 0ae2e1a..3cfdd40 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -103,9 +103,9 @@
   LittleEndian = false;
   PointerMemSize = 8;
   PointerABIAlignment   = 8;
-  DoubleABIAlignment = 8;
+  DoubleABIAlignment = 0;
   FloatABIAlignment = 4;
-  LongABIAlignment   = 8;
+  LongABIAlignment   = 0;
   IntABIAlignment   = 4;
   ShortABIAlignment  = 2;
   ByteABIAlignment  = 1;
@@ -114,9 +114,9 @@
   BytePrefAlignment = ByteABIAlignment;
   ShortPrefAlignment = ShortABIAlignment;
   IntPrefAlignment = IntABIAlignment;
-  LongPrefAlignment = LongABIAlignment;
+  LongPrefAlignment = 8;
   FloatPrefAlignment = FloatABIAlignment;
-  DoublePrefAlignment = DoubleABIAlignment;
+  DoublePrefAlignment = 8;
   PointerPrefAlignment = PointerABIAlignment;
   AggMinPrefAlignment = 0;
   
@@ -188,6 +188,13 @@
       break;
     }
   }
+
+  // Unless explicitly specified, the alignments for longs and doubles is capped by 
+  // pointer size.
+  if (LongABIAlignment == 0)
+	  LongABIAlignment = LongPrefAlignment = PointerMemSize;
+  if (DoubleABIAlignment == 0)
+    DoubleABIAlignment = DoublePrefAlignment = PointerMemSize;
 }
 
 TargetData::TargetData(const Module *M) {