Fix CodeGen/PowerPC/2007-02-16-AlignPacked.ll
authorChris Lattner <sabre@nondot.org>
Fri, 16 Feb 2007 23:11:51 +0000 (23:11 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 16 Feb 2007 23:11:51 +0000 (23:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34356 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetData.cpp

index b53ac562379dd5b5098a5ef9ded2a2fe90ad8c5f..9bab6f94ea3ea9d274f10c589a37b74aa0f545d9 100644 (file)
@@ -186,7 +186,7 @@ void TargetData::init(const std::string &TargetDescription) {
   setAlignment(FLOAT_ALIGN,     8,  8, 64);  // double
   setAlignment(VECTOR_ALIGN,    8,  8, 64);  // v2i32
   setAlignment(VECTOR_ALIGN,   16, 16, 128); // v16i8, v8i16, v4i32, ...
-  setAlignment(AGGREGATE_ALIGN, 0,  0,  0);  // struct, union, class, ...
+  setAlignment(AGGREGATE_ALIGN, 0,  8,  0);  // struct, union, class, ...
   
   while (!temp.empty()) {
     std::string token = getToken(temp, "-");
@@ -458,7 +458,7 @@ unsigned char TargetData::getAlignment(const Type *Ty, bool abi_or_pref) const {
     
   case Type::StructTyID: {
     // Packed structure types always have an ABI alignment of one.
-    if (cast<StructType>(Ty)->isPacked())
+    if (cast<StructType>(Ty)->isPacked() && abi_or_pref)
       return 1;
     
     // Get the layout annotation... which is lazily created on demand.