From e668bdaa52c0e172afd6b4f0b06abf27119005c5 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 31 Mar 2006 22:33:42 +0000 Subject: [PATCH] TargetData.cpp::getTypeInfo() was returning alignment of element type as the alignment of a packed type. This is obviously wrong. Added a workaround that returns the size of the packed type as its alignment. The correct fix would be to return a target dependent alignment value provided via TargetLowering (or some other interface). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27319 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/TargetData.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 40b762d8e73..63c5b6178a3 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -215,6 +215,9 @@ static inline void getTypeInfo(const Type *Ty, const TargetData *TD, getTypeInfo(PTy->getElementType(), TD, Size, Alignment); unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment; Size = AlignedSize*PTy->getNumElements(); + // FIXME: The alignments of specific packed types are target dependent. + // For now, just set it to be equal to Size. + Alignment = Size; return; } case Type::StructTyID: {