From 6e2329e33ae3f0239785af0fb69bf73ebe3b8899 Mon Sep 17 00:00:00 2001 From: Abhina Sreeskantharajan Date: Mon, 11 Jul 2022 08:28:47 -0400 Subject: [PATCH] [SystemZ][z/OS] Force alignment to fix build failure on z/OS The following commit https://reviews.llvm.org/D125998 added a static_assert which was triggered on z/OS because bitfields are always aligned to 1 regardless of type. ``` error: static_assert failed due to requirement 'alignof(llvm::SmallVector) <= alignof(llvm::MDNode::Header)' "LargeStorageVector too strongly aligned" ``` The solution was to force the alignment to be size_t. Reviewed By: wolfgangp Differential Revision: https://reviews.llvm.org/D129369 --- llvm/include/llvm/IR/Metadata.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h index be359d9..293eba9 100644 --- a/llvm/include/llvm/IR/Metadata.h +++ b/llvm/include/llvm/IR/Metadata.h @@ -951,7 +951,9 @@ class MDNode : public Metadata { /// The operands are in turn located immediately before the header. /// For resizable MDNodes, the space for the storage vector is also allocated /// immediately before the header, overlapping with the operands. - struct Header { + /// Explicity set alignment because bitfields by default have an + /// alignment of 1 on z/OS. + struct alignas(alignof(size_t)) Header { bool IsResizable : 1; bool IsLarge : 1; size_t SmallSize : 4; -- 2.7.4