xref: /llvm-project/llvm/test/CodeGen/PowerPC/aix-aggressive-merge-const.ll (revision f3131c99bf4816ac2fe48dcb5fa7b1f252b07f20)
1; RUN: llc --verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff \
2; RUN: -global-merge-all-const=true < %s | FileCheck %s
3
4; RUN: llc --verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff \
5; RUN: -global-merge-all-const=false < %s | FileCheck --check-prefix=NOMERGE %s
6
7%struct.pc_t = type { i8 }
8%struct.S = type { i32, i32, i32, i32, [9 x i32] }
9
10@constinit = private unnamed_addr constant <{ i32, i32, i32, i32, [9 x i32] }> <{ i32 0, i32 0, i32 0, i32 2, [9 x i32] zeroinitializer }>, align 4
11@.str = private unnamed_addr constant [6 x i8] c"hello\00", align 1
12@.str.1 = private unnamed_addr constant [6 x i8] c"world\00", align 1
13@.str.2 = private unnamed_addr constant [6 x i8] c"abcde\00", align 1
14@.str.3 = private unnamed_addr constant [6 x i8] c"fghij\00", align 1
15@pc = internal constant %struct.pc_t zeroinitializer, align 1
16@s = internal constant %struct.S { i32 1, i32 2, i32 3, i32 4, [9 x i32] [i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13] }, align 4
17
18; Function Attrs: mustprogress
19define noundef i32 @f5() {
20entry:
21  %call = tail call noundef i32 @f4(ptr noundef nonnull @pc)
22  ret i32 %call
23}
24
25declare noundef i32 @f4(ptr noundef)
26declare noundef i32 @printf(ptr nocapture noundef readonly, ...)
27
28define noundef i32 @f1() {
29entry:
30  %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
31  ret i32 %call
32}
33
34
35; Function Attrs: mustprogress nofree nounwind
36define noundef i32 @f2() {
37entry:
38  %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
39  ret i32 %call
40}
41
42define noundef i32 @f3() {
43entry:
44  %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
45  ret i32 %call
46}
47
48define noundef i32 @f7() {
49entry:
50  %call = tail call noundef i32 @f6(ptr noundef nonnull @s)
51  ret i32 %call
52}
53
54declare noundef i32 @f6(ptr noundef)
55
56; CHECK:             .csect L.._MergedGlobals[RO],2
57; CHECK-NEXT:        .lglobl pc                          # @_MergedGlobals
58; CHECK-NEXT:        .lglobl s
59; CHECK-NEXT:        .align  2
60; CHECK-NEXT:pc:
61; CHECK-NEXT:        .space  1
62; CHECK-NEXT:L...str:
63; CHECK-NEXT:        .string "hello"
64; CHECK-NEXT:L...str.1:
65; CHECK-NEXT:        .string "world"
66; CHECK-NEXT:L...str.2:
67; CHECK-NEXT:        .string "abcde"
68; CHECK-NEXT:L...str.3:
69; CHECK-NEXT:        .string "fghij"
70; CHECK-NEXT:        .space  3
71; CHECK-NEXT:L..constinit:
72; CHECK-NEXT:        .vbyte  4, 0                            # 0x0
73; CHECK-NEXT:        .vbyte  4, 0                            # 0x0
74; CHECK-NEXT:        .vbyte  4, 0                            # 0x0
75; CHECK-NEXT:        .vbyte  4, 2                            # 0x2
76; CHECK-NEXT:        .space  36
77; CHECK-NEXT:s:
78; CHECK-NEXT:        .vbyte  4, 1                            # 0x1
79; CHECK-NEXT:        .vbyte  4, 2                            # 0x2
80; CHECK-NEXT:        .vbyte  4, 3                            # 0x3
81; CHECK-NEXT:        .vbyte  4, 4                            # 0x4
82; CHECK-NEXT:        .vbyte  4, 5                            # 0x5
83; CHECK-NEXT:        .vbyte  4, 6                            # 0x6
84; CHECK-NEXT:        .vbyte  4, 7                            # 0x7
85; CHECK-NEXT:        .vbyte  4, 8                            # 0x8
86; CHECK-NEXT:        .vbyte  4, 9                            # 0x9
87; CHECK-NEXT:        .vbyte  4, 10                           # 0xa
88; CHECK-NEXT:        .vbyte  4, 11                           # 0xb
89; CHECK-NEXT:        .vbyte  4, 12                           # 0xc
90; CHECK-NEXT:        .vbyte  4, 13                           # 0xd
91
92
93; NOMERGE-NOT: L.._MergedGGlobals[RO]
94