@@ -219,7 +219,6 @@ DataLayout::DataLayout(StringRef LayoutString) {
219219 DefaultGlobalsAddrSpace = 0 ;
220220 TheFunctionPtrAlignType = FunctionPtrAlignType::Independent;
221221 ManglingMode = MM_None;
222- StructAlignment = LayoutAlignElem::get (Align (1 ), Align (8 ), 0 );
223222
224223 // Default alignments
225224 for (const auto &[Kind, Layout] : DefaultAlignments) {
@@ -250,8 +249,9 @@ DataLayout &DataLayout::operator=(const DataLayout &Other) {
250249 IntAlignments = Other.IntAlignments ;
251250 FloatAlignments = Other.FloatAlignments ;
252251 VectorAlignments = Other.VectorAlignments ;
253- StructAlignment = Other.StructAlignment ;
254252 Pointers = Other.Pointers ;
253+ StructABIAlignment = Other.StructABIAlignment ;
254+ StructPrefAlignment = Other.StructPrefAlignment ;
255255 NonIntegralAddressSpaces = Other.NonIntegralAddressSpaces ;
256256 return *this ;
257257}
@@ -271,7 +271,9 @@ bool DataLayout::operator==(const DataLayout &Other) const {
271271 IntAlignments == Other.IntAlignments &&
272272 FloatAlignments == Other.FloatAlignments &&
273273 VectorAlignments == Other.VectorAlignments &&
274- StructAlignment == Other.StructAlignment && Pointers == Other.Pointers ;
274+ Pointers == Other.Pointers &&
275+ StructABIAlignment == Other.StructABIAlignment &&
276+ StructPrefAlignment == Other.StructPrefAlignment ;
275277}
276278
277279Expected<DataLayout> DataLayout::parse (StringRef LayoutDescription) {
@@ -628,8 +630,8 @@ Error DataLayout::setAlignment(AlignTypeEnum AlignType, Align ABIAlign,
628630 SmallVectorImpl<LayoutAlignElem> *Alignments;
629631 switch (AlignType) {
630632 case AGGREGATE_ALIGN:
631- StructAlignment. ABIAlign = ABIAlign;
632- StructAlignment. PrefAlign = PrefAlign;
633+ StructABIAlignment = ABIAlign;
634+ StructPrefAlignment = PrefAlign;
633635 return Error::success ();
634636 case INTEGER_ALIGN:
635637 Alignments = &IntAlignments;
@@ -801,8 +803,7 @@ Align DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const {
801803
802804 // Get the layout annotation... which is lazily created on demand.
803805 const StructLayout *Layout = getStructLayout (cast<StructType>(Ty));
804- const Align Align =
805- abi_or_pref ? StructAlignment.ABIAlign : StructAlignment.PrefAlign ;
806+ const Align Align = abi_or_pref ? StructABIAlignment : StructPrefAlignment;
806807 return std::max (Align, Layout->getAlignment ());
807808 }
808809 case Type::IntegerTyID:
0 commit comments