Author: Nancy Wang Date: 2021-03-23T13:15:19-04:00 New Revision: f46c41febb88182f172d0260b55bd17e4c690a43
URL: https://github.com/llvm/llvm-project/commit/f46c41febb88182f172d0260b55bd17e4c690a43 DIFF: https://github.com/llvm/llvm-project/commit/f46c41febb88182f172d0260b55bd17e4c690a43.diff LOG: [SystemZ][z/OS] fix lit test related to alignment This patch is to fix lit test case failure relate to alignment, on z/OS, maximum alignment value for 64 bit mode is 16 and also fixed clang/test/Layout/itanium-union-bitfield.cpp, attribute ((aligned(4))) is needed for bit-field member in Union for z/OS because single bit-field has one byte alignment, this will make sure size and alignment will be correct value on z/OS. Differential Revision: https://reviews.llvm.org/D98793 Added: Modified: clang/test/AST/alignas_maybe_odr_cleanup.cpp clang/test/CodeGen/PR5060-align.c clang/test/Layout/itanium-union-bitfield.cpp Removed: ################################################################################ diff --git a/clang/test/AST/alignas_maybe_odr_cleanup.cpp b/clang/test/AST/alignas_maybe_odr_cleanup.cpp index 3adef4cba1440..ed34930e98a05 100644 --- a/clang/test/AST/alignas_maybe_odr_cleanup.cpp +++ b/clang/test/AST/alignas_maybe_odr_cleanup.cpp @@ -8,7 +8,7 @@ // RUN: | FileCheck %s struct FOO { - static const int vec_align_bytes = 32; + static const int vec_align_bytes = 16; void foo() { double a alignas(vec_align_bytes); ; @@ -17,7 +17,7 @@ struct FOO { // CHECK: | `-AlignedAttr {{.*}} <col:14> alignas // CHECK-NEXT: | `-ConstantExpr {{.*}} <col:22> 'int' -// CHECK-NEXT: | |-value: Int 32 +// CHECK-NEXT: | |-value: Int 16 // CHECK-NEXT: | `-ImplicitCastExpr {{.*}} <col:22> 'int' <LValueToRValue> // CHECK-NEXT: | `-DeclRefExpr {{.*}} <col:22> 'const int' lvalue Var {{.*}} 'vec_align_bytes' 'const int' non_odr_use_constant // CHECK-NEXT: `-NullStmt {{.*}} <line:14:5> diff --git a/clang/test/CodeGen/PR5060-align.c b/clang/test/CodeGen/PR5060-align.c index 34293a933aa9e..6e65175a71155 100644 --- a/clang/test/CodeGen/PR5060-align.c +++ b/clang/test/CodeGen/PR5060-align.c @@ -1,13 +1,13 @@ // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s -// CHECK: @foo.p = internal global i8 0, align 32 +// CHECK: @foo.p = internal global i8 0, align 16 char *foo(void) { - static char p __attribute__((aligned(32))); + static char p __attribute__((aligned(16))); return &p; } void bar(long n) { - // CHECK: align 32 - char p[n] __attribute__((aligned(32))); + // CHECK: align 16 + char p[n] __attribute__((aligned(16))); } diff --git a/clang/test/Layout/itanium-union-bitfield.cpp b/clang/test/Layout/itanium-union-bitfield.cpp index 961bf5b6f3b44..febfc46dfee54 100644 --- a/clang/test/Layout/itanium-union-bitfield.cpp +++ b/clang/test/Layout/itanium-union-bitfield.cpp @@ -1,15 +1,23 @@ // RUN: %clang_cc1 -emit-llvm-only -triple %itanium_abi_triple -fdump-record-layouts %s 2>/dev/null \ // RUN: | FileCheck %s +// On z/OS, a bit-field has single byte alignment. Add aligned(4) on z/OS so the union has +// the same size & alignment as expected. +#ifdef __MVS__ +#define ALIGN4 __attribute__((aligned(4))) +#else +#define ALIGN4 +#endif + union A { - int f1: 3; + int f1 : 3 ALIGN4; A(); }; A::A() {} union B { - char f1: 35; + char f1 : 35 ALIGN4; B(); }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits