[clang] [SystemZ] Move new test into existing CodeGen test. (PR #73230)

Jonas Paulsson via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 23 03:37:41 PST 2023


https://github.com/JonPsson1 created https://github.com/llvm/llvm-project/pull/73230

The test for emitted alignments is better placed in CodeGen.


>From 72e252610893f919d25916b800d2afd1f8b0b9a4 Mon Sep 17 00:00:00 2001
From: Jonas Paulsson <paulson1 at linux.ibm.com>
Date: Thu, 23 Nov 2023 12:33:11 +0100
Subject: [PATCH] [SystemZ] Move new test into existing CodeGen test.

---
 clang/test/CodeGen/SystemZ/align-systemz.c | 13 +++++++++
 clang/test/Driver/systemz-alignment.c      | 32 ----------------------
 2 files changed, 13 insertions(+), 32 deletions(-)
 delete mode 100644 clang/test/Driver/systemz-alignment.c

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;
-}



More information about the cfe-commits mailing list