[Alignment][NFC] Transition and simplify calls to DL::getABITypeAlignment

This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Differential Revision: https://reviews.llvm.org/D82956
This commit is contained in:
Guillaume Chatelet
2020-07-01 14:31:56 +00:00
parent 27bbc8ede1
commit d3085c2501
20 changed files with 53 additions and 74 deletions

View File

@@ -52,7 +52,7 @@ StructLayout::StructLayout(StructType *ST, const DataLayout &DL) {
// Loop over each of the elements, placing them in memory.
for (unsigned i = 0, e = NumElements; i != e; ++i) {
Type *Ty = ST->getElementType(i);
const Align TyAlign(ST->isPacked() ? 1 : DL.getABITypeAlignment(Ty));
const Align TyAlign = ST->isPacked() ? Align(1) : DL.getABITypeAlign(Ty);
// Add padding if necessary to align the data element properly.
if (!isAligned(TyAlign, StructSize)) {