[llvm] 4cf072e - [AIX] Use less than or equal to for some alignment tests on AIX

Zarko Todorovski via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 07:32:38 PDT 2021


Author: Zarko Todorovski
Date: 2021-06-28T10:32:32-04:00
New Revision: 4cf072e7fbb02e77332fa2a6dd26a7160ee4cc2e

URL: https://github.com/llvm/llvm-project/commit/4cf072e7fbb02e77332fa2a6dd26a7160ee4cc2e
DIFF: https://github.com/llvm/llvm-project/commit/4cf072e7fbb02e77332fa2a6dd26a7160ee4cc2e.diff

LOG: [AIX] Use less than or equal to for some alignment tests on AIX

On AIX the alignment implementation has the storage aligned to the
preferred alignment instead of the alignment of a type. Macro guard
these tests for AIX and have them pass when the "reference alignment" is
less than or equal to the alignment observed. In other words, the
alignment applied is at least as strict as the required alignment.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D104786

Added: 
    

Modified: 
    llvm/unittests/Support/AlignOfTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/AlignOfTest.cpp b/llvm/unittests/Support/AlignOfTest.cpp
index d8cabde6c727..f84895c18602 100644
--- a/llvm/unittests/Support/AlignOfTest.cpp
+++ b/llvm/unittests/Support/AlignOfTest.cpp
@@ -131,9 +131,17 @@ TEST(AlignOfTest, BasicAlignedArray) {
   EXPECT_EQ(alignof(T<long>), alignof(AlignedCharArrayUnion<long>));
   EXPECT_EQ(alignof(T<long long>), alignof(AlignedCharArrayUnion<long long>));
   EXPECT_EQ(alignof(T<float>), alignof(AlignedCharArrayUnion<float>));
+#ifdef _AIX
+  EXPECT_LE(alignof(T<double>), alignof(AlignedCharArrayUnion<double>));
+  EXPECT_LE(alignof(T<long double>),
+            alignof(AlignedCharArrayUnion<long double>));
+  EXPECT_LE(alignof(S4), alignof(AlignedCharArrayUnion<S4>));
+#else
   EXPECT_EQ(alignof(T<double>), alignof(AlignedCharArrayUnion<double>));
   EXPECT_EQ(alignof(T<long double>),
             alignof(AlignedCharArrayUnion<long double>));
+  EXPECT_EQ(alignof(S4), alignof(AlignedCharArrayUnion<S4>));
+#endif
   EXPECT_EQ(alignof(T<void *>), alignof(AlignedCharArrayUnion<void *>));
   EXPECT_EQ(alignof(T<int *>), alignof(AlignedCharArrayUnion<int *>));
   EXPECT_EQ(alignof(T<double (*)(double)>),
@@ -143,7 +151,6 @@ TEST(AlignOfTest, BasicAlignedArray) {
   EXPECT_EQ(alignof(S1), alignof(AlignedCharArrayUnion<S1>));
   EXPECT_EQ(alignof(S2), alignof(AlignedCharArrayUnion<S2>));
   EXPECT_EQ(alignof(S3), alignof(AlignedCharArrayUnion<S3>));
-  EXPECT_EQ(alignof(S4), alignof(AlignedCharArrayUnion<S4>));
   EXPECT_EQ(alignof(S5), alignof(AlignedCharArrayUnion<S5>));
   EXPECT_EQ(alignof(S6), alignof(AlignedCharArrayUnion<S6>));
   EXPECT_EQ(alignof(D1), alignof(AlignedCharArrayUnion<D1>));


        


More information about the llvm-commits mailing list