1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

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).

llvm-svn: 27319
This commit is contained in:
Evan Cheng 2006-03-31 22:33:42 +00:00
parent b088cfc01a
commit fc0a2ac06e

View File

@ -215,6 +215,9 @@ static inline void getTypeInfo(const Type *Ty, const TargetData *TD,
getTypeInfo(PTy->getElementType(), TD, Size, Alignment); getTypeInfo(PTy->getElementType(), TD, Size, Alignment);
unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment; unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment;
Size = AlignedSize*PTy->getNumElements(); 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; return;
} }
case Type::StructTyID: { case Type::StructTyID: {