@@ -219,7 +219,6 @@ DataLayout::DataLayout(StringRef LayoutString) {
219
219
DefaultGlobalsAddrSpace = 0 ;
220
220
TheFunctionPtrAlignType = FunctionPtrAlignType::Independent;
221
221
ManglingMode = MM_None;
222
- StructAlignment = LayoutAlignElem::get (Align (1 ), Align (8 ), 0 );
223
222
224
223
// Default alignments
225
224
for (const auto &[Kind, Layout] : DefaultAlignments) {
@@ -250,8 +249,9 @@ DataLayout &DataLayout::operator=(const DataLayout &Other) {
250
249
IntAlignments = Other.IntAlignments ;
251
250
FloatAlignments = Other.FloatAlignments ;
252
251
VectorAlignments = Other.VectorAlignments ;
253
- StructAlignment = Other.StructAlignment ;
254
252
Pointers = Other.Pointers ;
253
+ StructABIAlignment = Other.StructABIAlignment ;
254
+ StructPrefAlignment = Other.StructPrefAlignment ;
255
255
NonIntegralAddressSpaces = Other.NonIntegralAddressSpaces ;
256
256
return *this ;
257
257
}
@@ -271,7 +271,9 @@ bool DataLayout::operator==(const DataLayout &Other) const {
271
271
IntAlignments == Other.IntAlignments &&
272
272
FloatAlignments == Other.FloatAlignments &&
273
273
VectorAlignments == Other.VectorAlignments &&
274
- StructAlignment == Other.StructAlignment && Pointers == Other.Pointers ;
274
+ Pointers == Other.Pointers &&
275
+ StructABIAlignment == Other.StructABIAlignment &&
276
+ StructPrefAlignment == Other.StructPrefAlignment ;
275
277
}
276
278
277
279
Expected<DataLayout> DataLayout::parse (StringRef LayoutDescription) {
@@ -628,8 +630,8 @@ Error DataLayout::setAlignment(AlignTypeEnum AlignType, Align ABIAlign,
628
630
SmallVectorImpl<LayoutAlignElem> *Alignments;
629
631
switch (AlignType) {
630
632
case AGGREGATE_ALIGN:
631
- StructAlignment. ABIAlign = ABIAlign;
632
- StructAlignment. PrefAlign = PrefAlign;
633
+ StructABIAlignment = ABIAlign;
634
+ StructPrefAlignment = PrefAlign;
633
635
return Error::success ();
634
636
case INTEGER_ALIGN:
635
637
Alignments = &IntAlignments;
@@ -801,8 +803,7 @@ Align DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const {
801
803
802
804
// Get the layout annotation... which is lazily created on demand.
803
805
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;
806
807
return std::max (Align, Layout->getAlignment ());
807
808
}
808
809
case Type::IntegerTyID:
0 commit comments