Skip to content

Commit ae1cafc

Browse files
[SystemZ] Add codegen test for global string alignment
This commit adds a test 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 318f053 commit ae1cafc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; RUN: opt < %s --passes=instcombine -S -mtriple=systemz-unknown | FileCheck %s
2+
;
3+
; Check that string replacements inserted by the instcombiner are properly aligned.
4+
; The specific case checked replaces `printf("foo\n")` with `puts("foo")`
5+
6+
@msg1 = constant [17 x i8] c"Alignment Check\0A\00", align 2
7+
; CHECK: c"Alignment Check\00", align 2
8+
9+
; Function Attrs: noinline nounwind
10+
define dso_local void @foo() #0 {
11+
%call = call signext i32 (ptr, ...) @printf(ptr noundef @msg1)
12+
ret void
13+
}
14+
15+
declare signext i32 @printf(ptr noundef, ...) #1

0 commit comments

Comments
 (0)