Skip to content

Commit 75dd66c

Browse files
[SystemZ] Add codegen test for global string alignment
This commit adds a test to the `clang` test suite for the SystemZ backend that checks for the correct alignment of global strings created by the PrintFOptimizer for the case `printf("foo\n")` -> `puts("foo")`.
1 parent 3b5ae72 commit 75dd66c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %clang_cc1 -O1 -triple s390x-linux-gnu -emit-llvm %s -o - | FileCheck %s
2+
3+
// #include <stdio.h>
4+
5+
// CHECK: @msg1 = local_unnamed_addr constant [13 x i8] c"Hello World\0A\00", align 2
6+
// CHECK: @msg1.clipped = private unnamed_addr constant [12 x i8] c"Hello World\00", align 2
7+
8+
const char msg1 [] = "Hello World\n";
9+
10+
extern int printf(const char *__restrict __format, ...);
11+
12+
void foo() {
13+
printf(msg1);
14+
}

0 commit comments

Comments
 (0)