1 ; RUN: llc -o - %s | FileCheck %s
2 ; Make sure RegAllocGreedy/SplitKit do not produce invalid liveness information
3 ; and crash when splitting a liverange twice and rematerializing each time.
4 ; (Sorry for the testcase; this was ran through bugpoint and then manually
5 ; reduced for several hours but is still big...)
6 target triple = "thumbv7-apple-ios"
8 %struct.ham = type { %struct.wombat.0 }
9 %struct.wombat.0 = type { %struct.barney }
10 %struct.barney = type { %struct.snork.1 }
11 %struct.snork.1 = type { %struct.wobble.2 }
12 %struct.wobble.2 = type { %struct.blam }
13 %struct.blam = type { i32, i32, ptr }
14 %struct.ham.3 = type { %struct.pluto }
15 %struct.pluto = type { ptr, %struct.snork.5, %struct.wibble }
16 %struct.zot = type { ptr }
17 %struct.blam.4 = type <{ %struct.zot, ptr, ptr, i8, [3 x i8] }>
18 %struct.snork.5 = type { %struct.quux }
19 %struct.quux = type { %struct.zot }
20 %struct.wibble = type { %struct.widget }
21 %struct.widget = type { i32 }
22 %struct.bar = type { %struct.spam }
23 %struct.spam = type { ptr, %struct.wobble, %struct.zot.7 }
24 %struct.wobble = type { %struct.wibble.6 }
25 %struct.wibble.6 = type { %struct.zot }
26 %struct.zot.7 = type { %struct.ham.8 }
27 %struct.ham.8 = type { i32 }
28 %struct.hoge = type { %struct.ham, %struct.foo }
29 %struct.foo = type { float, float }
30 %struct.wombat = type { %struct.ham, float }
31 %struct.snork = type { %struct.ham.9, [11 x i8] }
32 %struct.ham.9 = type { i8 }
34 @global = external global i8
35 @global.1 = private constant [20 x i8] c"aaaaaaaaaaaaaaaaaa0\00"
36 @global.2 = external constant [27 x i8]
37 @global.3 = external global %struct.ham
38 @global.4 = external constant [47 x i8]
39 @global.5 = external constant [61 x i8]
40 @global.6 = external constant [40 x i8]
41 @global.7 = external constant [24 x i8]
42 @global.8 = external constant [20 x i8]
43 @global.9 = external global %struct.ham
44 @global.10 = external global %struct.ham
45 @global.11 = external global %struct.ham
46 @global.12 = external global %struct.ham
47 @global.13 = external global %struct.ham
48 @global.14 = external global %struct.ham
49 @global.15 = external global %struct.ham
50 @global.16 = external global %struct.ham
51 @global.17 = external global %struct.ham
52 @global.18 = external constant [35 x i8]
53 @global.19 = external global %struct.ham
54 @global.20 = external constant [53 x i8]
55 @global.21 = external global %struct.ham
56 @global.22 = external global %struct.ham
57 @global.23 = external global %struct.ham
58 @global.24 = external constant [32 x i8]
59 @global.25 = external global %struct.ham
60 @global.26 = external constant [47 x i8]
61 @global.27 = external global %struct.ham
62 @global.28 = external constant [45 x i8]
63 @global.29 = external global %struct.ham
64 @global.30 = external global %struct.ham
65 @global.31 = external constant [24 x i8]
66 @global.32 = external global %struct.ham
67 @global.33 = external global %struct.ham
68 @global.34 = external global %struct.ham
69 @global.35 = external global %struct.ham
70 @global.36 = external constant [27 x i8]
71 @global.37 = external global %struct.ham
72 @global.38 = external constant [10 x i8]
73 @global.39 = external global %struct.ham
74 @global.40 = external global %struct.ham
75 @global.41 = external global %struct.ham
76 @global.42 = external global %struct.ham
77 @global.43 = external global %struct.ham
78 @global.44 = external constant [41 x i8]
79 @global.45 = external global %struct.ham
80 @global.46 = external global %struct.ham
81 @global.47 = external global %struct.ham
82 @global.48 = external global %struct.ham
83 @global.49 = external constant [52 x i8]
84 @global.50 = external constant [47 x i8]
85 @global.51 = external global %struct.ham
86 @global.52 = external global %struct.ham
87 @global.53 = external global %struct.ham
88 @global.54 = external global %struct.ham
89 @global.55 = external global %struct.ham.3
90 @global.56 = external global %struct.bar
91 @global.57 = external global i8
93 declare ptr @bar(ptr returned)
95 declare i32 @__cxa_atexit(ptr, ptr, ptr)
97 declare ptr @wobble(ptr returned, ptr )
99 declare i32 @quux(...)
101 declare ptr @_Znwm(i32)
103 declare i32 @wobble.58(ptr, [1 x i32], ptr , ptr )
105 declare i32 @widget(ptr, [1 x i32], ptr , ptr )
107 ; Just check we didn't crash and did output something...
110 define internal void @func() section "__TEXT,__StaticInit,regular,pure_instructions" personality ptr @quux {
111 %tmp = tail call i32 @__cxa_atexit(ptr @bar, ptr @global.3, ptr @global) #0
112 %tmp2 = invoke ptr @wobble(ptr undef, ptr @global.9)
113 to label %bb14 unwind label %bbunwind
116 %tmp15 = getelementptr i8, ptr undef, i32 12
117 store i8 0, ptr %tmp15
118 %tmp16 = icmp eq i8 undef, 0
119 br i1 %tmp16, label %bb28, label %bb18
122 br i1 undef, label %bb21, label %bb29
125 %tmp22 = call ptr @_Znwm(i32 16)
126 store i32 17, ptr @global.10
127 %tmp23 = call ptr @_Znwm(i32 32)
128 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.2, i32 26, i1 false)
129 store i32 33, ptr @global.11
130 store i32 23, ptr getelementptr (%struct.ham, ptr @global.11, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
131 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.7, i32 23, i1 false)
132 %tmp24 = call i32 @__cxa_atexit(ptr @bar, ptr @global.11, ptr @global) #0
133 store i32 49, ptr @global.12
134 store i32 37, ptr getelementptr (%struct.ham, ptr @global.13, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
135 call void @llvm.memset.p0.i32(ptr align 4 @global.14, i8 0, i32 12, i1 false)
136 %tmp25 = call ptr @_Znwm(i32 48)
137 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmp25, ptr align 1 @global.6, i32 39, i1 false)
138 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.4, i32 46, i1 false)
139 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.5, i32 60, i1 false)
140 %tmp26 = call ptr @_Znwm(i32 48)
141 store i32 65, ptr @global.15
142 %tmp27 = icmp eq i8 undef, 0
143 br i1 %tmp27, label %bb30, label %bb33
146 call void @llvm.trap()
150 call void @llvm.trap()
154 %tmp31 = icmp eq i32 undef, 37
155 br i1 %tmp31, label %bb32, label %bb30
158 store i8 1, ptr @global.57
162 %tmp34 = call ptr @_Znwm(i32 32)
163 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.1, i32 19, i1 false)
164 store i32 17, ptr @global.16
165 store i32 65, ptr @global.17
166 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.18, i32 34, i1 false)
167 store i32 65, ptr @global.19
168 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.20, i32 52, i1 false)
169 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.8, i32 19, i1 false)
170 store i32 37, ptr getelementptr (%struct.ham, ptr @global.21, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
171 %tmp35 = call ptr @_Znwm(i32 32)
172 store i8 16, ptr @global.22
173 %tmp36 = call ptr @_Znwm(i32 32)
174 store i32 31, ptr getelementptr (%struct.ham, ptr @global.23, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
175 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmp36, ptr align 1 @global.24, i32 31, i1 false)
176 %tmp37 = getelementptr i8, ptr %tmp36, i32 31
177 store i8 0, ptr %tmp37
178 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.26, i32 46, i1 false)
179 %tmp38 = call i32 @__cxa_atexit(ptr @bar, ptr @global.25, ptr @global) #0
180 %tmp39 = call ptr @_Znwm(i32 48)
181 store i32 44, ptr getelementptr (%struct.ham, ptr @global.27, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
182 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmp39, ptr align 1 @global.28, i32 44, i1 false)
183 %tmp40 = getelementptr i8, ptr %tmp39, i32 44
184 store i8 0, ptr %tmp40
185 call void @llvm.memset.p0.i32(ptr align 4 @global.29, i8 0, i32 12, i1 false)
186 %tmp41 = call ptr @_Znwm(i32 32)
187 store i32 23, ptr getelementptr (%struct.ham, ptr @global.30, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
188 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmp41, ptr align 1 @global.31, i32 23, i1 false)
189 %tmp42 = getelementptr i8, ptr %tmp41, i32 23
190 store i8 0, ptr %tmp42
191 call void @llvm.memset.p0.i32(ptr align 4 @global.32, i8 0, i32 12, i1 false)
192 store i8 16, ptr @global.32
193 %tmp43 = call i32 @__cxa_atexit(ptr @bar, ptr @global.33, ptr @global) #0
194 %tmp44 = call ptr @_Znwm(i32 16)
195 call void @llvm.memset.p0.i32(ptr align 4 @global.34, i8 0, i32 12, i1 false)
196 call void @llvm.memset.p0.i32(ptr align 4 @global.9, i8 0, i32 12, i1 false)
197 %tmp45 = call ptr @_Znwm(i32 32)
198 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %tmp45, ptr align 1 @global.36, i32 26, i1 false)
199 call void @llvm.memset.p0.i32(ptr align 4 @global.37, i8 0, i32 12, i1 false)
200 call void @llvm.memcpy.p0.p0.i32(ptr align 1 getelementptr (%struct.snork, ptr @global.37, i32 0, i32 1, i32 0), ptr align 1 @global.38, i32 9, i1 false)
201 store i32 17, ptr @global.39
202 %tmp46 = call i32 @__cxa_atexit(ptr @bar, ptr @global.40, ptr @global) #0
203 %tmp47 = call ptr @_Znwm(i32 32)
204 %tmp48 = getelementptr i8, ptr %tmp47, i32 21
205 store i8 0, ptr %tmp48
206 store i32 33, ptr @global.41
207 store i32 15, ptr getelementptr (%struct.ham, ptr @global.42, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
208 %tmp49 = call i32 @__cxa_atexit(ptr @bar, ptr @global.43, ptr @global) #0
209 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.44, i32 40, i1 false)
210 %tmp50 = call i32 @__cxa_atexit(ptr @bar, ptr @global.45, ptr @global) #0
211 %tmp51 = call i32 @__cxa_atexit(ptr @bar, ptr @global.46, ptr @global) #0
212 %tmp52 = call ptr @_Znwm(i32 32)
213 store ptr %tmp52, ptr getelementptr (%struct.ham, ptr @global.47, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2)
214 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.49, i32 51, i1 false)
215 %tmp53 = call i32 @__cxa_atexit(ptr @bar, ptr @global.48, ptr @global) #0
216 call void @llvm.memcpy.p0.p0.i32(ptr align 1 undef, ptr align 1 @global.50, i32 46, i1 false)
217 store i32 33, ptr @global.51
218 store i32 37, ptr getelementptr (%struct.ham, ptr @global.52, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1)
219 %tmp54 = invoke ptr @wobble(ptr undef, ptr @global.54)
220 to label %bb58 unwind label %bbunwind
223 %tmp59 = invoke i32 @wobble.58(ptr @global.55, [1 x i32] [i32 ptrtoint (ptr getelementptr (%struct.ham.3, ptr @global.55, i32 0, i32 0, i32 1, i32 0, i32 0) to i32)], ptr undef, ptr undef)
224 to label %bb71 unwind label %bbunwind
227 %tmp72 = invoke i32 @widget(ptr @global.56, [1 x i32] [i32 ptrtoint (ptr getelementptr (%struct.bar, ptr @global.56, i32 0, i32 0, i32 1, i32 0, i32 0) to i32)], ptr undef, ptr undef)
228 to label %bb73 unwind label %bbunwind
234 %tmp75 = landingpad { ptr, i32 }
236 resume { ptr, i32 } undef
239 declare void @llvm.trap()
241 declare void @llvm.memcpy.p0.p0.i32(ptr , ptr , i32, i1)
243 declare void @llvm.memset.p0.i32(ptr , i8, i32, i1)
245 attributes #0 = { nounwind }