1 ; RUN: llc -mtriple aarch64-apple-darwin -O0 -global-isel -verify-machineinstrs %s -o - 2>&1 | FileCheck %s
2 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
3 target triple = "arm64-apple-ios13.0.0"
5 @t_val = thread_local global i32 0, align 4
6 @.str = private unnamed_addr constant [5 x i8] c"str1\00", align 1
7 @str1 = global ptr @.str, align 8
8 @.str.1 = private unnamed_addr constant [5 x i8] c"str2\00", align 1
9 @str2 = global ptr @.str.1, align 8
10 @.str.2 = private unnamed_addr constant [5 x i8] c"str3\00", align 1
11 @str3 = global ptr @.str.2, align 8
12 @.str.3 = private unnamed_addr constant [5 x i8] c"str4\00", align 1
13 @str4 = global ptr @.str.3, align 8
14 @.str.4 = private unnamed_addr constant [5 x i8] c"str5\00", align 1
15 @str5 = global ptr @.str.4, align 8
16 @.str.5 = private unnamed_addr constant [5 x i8] c"str6\00", align 1
17 @str6 = global ptr @.str.5, align 8
18 @.str.6 = private unnamed_addr constant [5 x i8] c"str7\00", align 1
19 @str7 = global ptr @.str.6, align 8
20 @.str.7 = private unnamed_addr constant [5 x i8] c"str8\00", align 1
21 @str8 = global ptr @.str.7, align 8
22 @.str.8 = private unnamed_addr constant [5 x i8] c"str9\00", align 1
23 @str9 = global ptr @.str.8, align 8
24 @.str.9 = private unnamed_addr constant [6 x i8] c"str10\00", align 1
25 @str10 = global ptr @.str.9, align 8
26 @.str.10 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
27 @.str.11 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
28 @.str.12 = private unnamed_addr constant [4 x i8] c"xyz\00", align 1
31 ; This test checks that we don't re-use the register for the variable descriptor
33 ; CHECK: adrp x[[PTR1:[0-9]+]], _t_val@TLVPPAGE
34 ; CHECK: ldr x0, [x[[PTR1]], _t_val@TLVPPAGEOFF]
35 ; CHECK: ldr x[[FPTR:[0-9]+]], [x0]
36 ; CHECK: blr x[[FPTR]]
38 define void @_Z4funcPKc(ptr %id) {
40 %id.addr = alloca ptr, align 8
41 store ptr %id, ptr %id.addr, align 8
42 %0 = load ptr, ptr %id.addr, align 8
43 %1 = load ptr, ptr @str1, align 8
44 %cmp = icmp eq ptr %0, %1
45 br i1 %cmp, label %if.then, label %if.else
47 if.then: ; preds = %entry
48 %2 = load ptr, ptr @str1, align 8
49 %call = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %2)
50 %3 = load ptr, ptr @str2, align 8
51 %call1 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %3)
52 %4 = load ptr, ptr @str3, align 8
53 %call2 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %4)
54 %5 = load ptr, ptr @str4, align 8
55 %call3 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %5)
56 %6 = load ptr, ptr @str5, align 8
57 %call4 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %6)
58 %7 = load ptr, ptr @str6, align 8
59 %call5 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %7)
60 %8 = load ptr, ptr @str7, align 8
61 %call6 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %8)
62 %9 = load ptr, ptr @str8, align 8
63 %call7 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %9)
64 %10 = load ptr, ptr @str9, align 8
65 %call8 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %10)
66 %11 = load ptr, ptr @str10, align 8
67 %call9 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %11)
68 %12 = load i32, ptr @t_val, align 4
69 %call10 = call i32 (ptr, ...) @printf(ptr @.str.11, i32 %12)
72 if.else: ; preds = %entry
73 %13 = load ptr, ptr %id.addr, align 8
74 %14 = load ptr, ptr @str2, align 8
75 %cmp11 = icmp eq ptr %13, %14
76 br i1 %cmp11, label %if.then12, label %if.else24
78 if.then12: ; preds = %if.else
79 %15 = load ptr, ptr @str1, align 8
80 %call13 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %15)
81 %16 = load ptr, ptr @str2, align 8
82 %call14 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %16)
83 %17 = load ptr, ptr @str3, align 8
84 %call15 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %17)
85 %18 = load ptr, ptr @str4, align 8
86 %call16 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %18)
87 %19 = load ptr, ptr @str5, align 8
88 %call17 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %19)
89 %20 = load ptr, ptr @str6, align 8
90 %call18 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %20)
91 %21 = load ptr, ptr @str7, align 8
92 %call19 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %21)
93 %22 = load ptr, ptr @str8, align 8
94 %call20 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %22)
95 %23 = load ptr, ptr @str9, align 8
96 %call21 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %23)
97 %24 = load ptr, ptr @str10, align 8
98 %call22 = call i32 (ptr, ...) @printf(ptr @.str.10, ptr %24)
99 %25 = load i32, ptr @t_val, align 4
100 %call23 = call i32 (ptr, ...) @printf(ptr @.str.11, i32 %25)
103 if.else24: ; preds = %if.else
104 %26 = load ptr, ptr %id.addr, align 8
105 %27 = load ptr, ptr @str3, align 8
106 %cmp25 = icmp eq ptr %26, %27
107 br i1 %cmp25, label %if.then26, label %if.else27
109 if.then26: ; preds = %if.else24
112 if.else27: ; preds = %if.else24
113 %28 = load ptr, ptr %id.addr, align 8
114 %29 = load ptr, ptr @str4, align 8
115 %cmp28 = icmp eq ptr %28, %29
116 br i1 %cmp28, label %if.then29, label %if.else30
118 if.then29: ; preds = %if.else27
121 if.else30: ; preds = %if.else27
122 %30 = load ptr, ptr %id.addr, align 8
123 %31 = load ptr, ptr @str5, align 8
124 %cmp31 = icmp eq ptr %30, %31
125 br i1 %cmp31, label %if.then32, label %if.else33
127 if.then32: ; preds = %if.else30
130 if.else33: ; preds = %if.else30
131 %32 = load ptr, ptr %id.addr, align 8
132 %33 = load ptr, ptr @str6, align 8
133 %cmp34 = icmp eq ptr %32, %33
134 br i1 %cmp34, label %if.then35, label %if.else36
136 if.then35: ; preds = %if.else33
139 if.else36: ; preds = %if.else33
140 %34 = load ptr, ptr %id.addr, align 8
141 %35 = load ptr, ptr @str7, align 8
142 %cmp37 = icmp eq ptr %34, %35
143 br i1 %cmp37, label %if.then38, label %if.else39
145 if.then38: ; preds = %if.else36
148 if.else39: ; preds = %if.else36
149 %36 = load ptr, ptr %id.addr, align 8
150 %37 = load ptr, ptr @str8, align 8
151 %cmp40 = icmp eq ptr %36, %37
152 br i1 %cmp40, label %if.then41, label %if.else42
154 if.then41: ; preds = %if.else39
157 if.else42: ; preds = %if.else39
158 %38 = load ptr, ptr %id.addr, align 8
159 %39 = load ptr, ptr @str9, align 8
160 %cmp43 = icmp eq ptr %38, %39
161 br i1 %cmp43, label %if.then44, label %if.else45
163 if.then44: ; preds = %if.else42
166 if.else45: ; preds = %if.else42
167 %40 = load ptr, ptr %id.addr, align 8
168 %41 = load ptr, ptr @str10, align 8
169 %cmp46 = icmp eq ptr %40, %41
170 br i1 %cmp46, label %if.then47, label %if.end
172 if.then47: ; preds = %if.else45
175 if.end: ; preds = %if.then47, %if.else45
178 if.end48: ; preds = %if.end, %if.then44
181 if.end49: ; preds = %if.end48, %if.then41
184 if.end50: ; preds = %if.end49, %if.then38
187 if.end51: ; preds = %if.end50, %if.then35
190 if.end52: ; preds = %if.end51, %if.then32
193 if.end53: ; preds = %if.end52, %if.then29
196 if.end54: ; preds = %if.end53, %if.then26
199 if.end55: ; preds = %if.end54, %if.then12
202 if.end56: ; preds = %if.end55, %if.then
205 declare i32 @printf(ptr, ...)