Skip to content

Conversation

@JonPsson1
Copy link
Contributor

The test for emitted alignments is better placed in CodeGen.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Nov 23, 2023
@JonPsson1 JonPsson1 requested a review from uweigand November 23, 2023 11:37
@llvmbot
Copy link
Member

llvmbot commented Nov 23, 2023

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Jonas Paulsson (JonPsson1)

Changes

The test for emitted alignments is better placed in CodeGen.


Full diff: https://github.com/llvm/llvm-project/pull/73230.diff

2 Files Affected:

  • (modified) clang/test/CodeGen/SystemZ/align-systemz.c (+13)
  • (removed) clang/test/Driver/systemz-alignment.c (-32)
diff --git a/clang/test/CodeGen/SystemZ/align-systemz.c b/clang/test/CodeGen/SystemZ/align-systemz.c
index 5ba446665fef803..9daff6ee9760974 100644
--- a/clang/test/CodeGen/SystemZ/align-systemz.c
+++ b/clang/test/CodeGen/SystemZ/align-systemz.c
@@ -25,6 +25,19 @@ void func (void)
   s = es;
 }
 
+// Test that a global variable with an incomplete type gets the minimum
+// alignment of 2 per the ABI if no alignment was specified by user.
+//
+// CHECK-DAG: @VarNoAl {{.*}} align 2
+// CHECK-DAG: @VarExplAl1  {{.*}} align 1
+// CHECK-DAG: @VarExplAl4  {{.*}} align 4
+struct incomplete_ty;
+extern struct incomplete_ty VarNoAl;
+extern struct incomplete_ty __attribute__((aligned(1))) VarExplAl1;
+extern struct incomplete_ty __attribute__((aligned(4))) VarExplAl4;
+struct incomplete_ty *fun0 (void) { return &VarNoAl; }
+struct incomplete_ty *fun1 (void) { return &VarExplAl1; }
+struct incomplete_ty *fun2 (void) { return &VarExplAl4; }
 
 // The SystemZ ABI aligns __int128_t to only eight bytes.
 
diff --git a/clang/test/Driver/systemz-alignment.c b/clang/test/Driver/systemz-alignment.c
deleted file mode 100644
index 6f3b2bc38be3688..000000000000000
--- a/clang/test/Driver/systemz-alignment.c
+++ /dev/null
@@ -1,32 +0,0 @@
-// RUN: %clang --target=s390x-linux -S -emit-llvm -o - %s | FileCheck %s
-//
-// Test that a global variable with an incomplete type gets the minimum
-// alignment of 2 per the ABI if no alignment was specified by user.
-//
-// CHECK:      @VarNoAl {{.*}} align 2
-// CHECK-NEXT: @VarExplAl1  {{.*}} align 1
-// CHECK-NEXT: @VarExplAl4  {{.*}} align 4
-
-// No alignemnt specified by user.
-struct incomplete_ty_noal;
-extern struct incomplete_ty_noal VarNoAl;
-struct incomplete_ty_noal *fun0 (void)
-{
-  return &VarNoAl;
-}
-
-// User-specified alignment of 1.
-struct incomplete_ty_al1;
-extern struct incomplete_ty_al1 __attribute__((aligned(1))) VarExplAl1;
-struct incomplete_ty_al1 *fun1 (void)
-{
-  return &VarExplAl1;
-}
-
-// User-specified alignment of 4.
-struct incomplete_ty_al4;
-extern struct incomplete_ty_al4 __attribute__((aligned(4))) VarExplAl4;
-struct incomplete_ty_al4 *fun2 (void)
-{
-  return &VarExplAl4;
-}

@JonPsson1
Copy link
Contributor Author

Moving recently added tests from Driver to CodeGen, per discussion for original PR (#72886).

Copy link
Member

@uweigand uweigand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@JonPsson1 JonPsson1 merged commit 521b468 into llvm:main Nov 23, 2023
@JonPsson1 JonPsson1 deleted the AlignOpaqueTy branch November 23, 2023 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants