1; Bitcode compatibility test for llvm 3.6.2
2;
3; N.b: This is 3.6.2-compatible IR. The CHECK lines occasionally differ from
4;      the IR used to generate the bitcode, and may need to be updated. These
5;      locations are tagged with an 'XXX'.
6
7; RUN: llvm-dis < %s.bc | FileCheck %s
8
9target datalayout = "E"
10; CHECK: target datalayout = "E"
11
12target triple = "x86_64-apple-macosx10.10.0"
13; CHECK: target triple = "x86_64-apple-macosx10.10.0"
14
15;; Module-level assembly
16module asm "beep boop"
17; CHECK: module asm "beep boop"
18
19;; Comdats
20$comdat.any = comdat any
21; CHECK: $comdat.any = comdat any
22$comdat.exactmatch = comdat exactmatch
23; CHECK: $comdat.exactmatch = comdat exactmatch
24$comdat.largest = comdat largest
25; CHECK: $comdat.largest = comdat largest
26$comdat.noduplicates = comdat noduplicates
27; CHECK: $comdat.noduplicates = comdat noduplicates
28$comdat.samesize = comdat samesize
29; CHECK: $comdat.samesize = comdat samesize
30
31; Global Variables -- comdat
32@comdat.any = global i32 0, comdat
33; CHECK: @comdat.any = global i32 0, comdat
34@comdat.exactmatch = global i32 0, comdat
35; CHECK: @comdat.exactmatch = global i32 0, comdat
36@comdat.largest = global i32 0, comdat
37; CHECK: @comdat.largest = global i32 0, comdat
38@comdat.noduplicates = global i32 0, comdat
39; CHECK: @comdat.noduplicates = global i32 0, comdat
40@comdat.samesize = global i32 0, comdat
41; CHECK: @comdat.samesize = global i32 0, comdat
42
43; Force two globals from different comdats into sections with the same name.
44$comdat1 = comdat any
45$comdat2 = comdat any
46@g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
47; CHECK: @g.comdat1 = global i32 0, section "SharedSection", comdat($comdat1)
48@g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
49; CHECK: @g.comdat2 = global i32 0, section "SharedSection", comdat($comdat2)
50
51;; Constants
52@const.true = constant i1 true
53; CHECK: @const.true = constant i1 true
54@const.false = constant i1 false
55; CHECK: @const.false = constant i1 false
56@const.int = constant i32 zeroinitializer
57; CHECK: @const.int = constant i32 0
58@const.float = constant double 0.0
59; CHECK: @const.float = constant double 0.0
60@const.null = constant i8* null
61; CHECK: @const.null = constant i8* null
62%const.struct.type = type { i32, i8 }
63%const.struct.type.packed = type <{ i32, i8 }>
64@const.struct = constant %const.struct.type { i32 -1, i8 undef }
65; CHECK: @const.struct = constant %const.struct.type { i32 -1, i8 undef }
66@const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
67; CHECK: @const.struct.packed = constant %const.struct.type.packed <{ i32 -1, i8 1 }>
68@const.array = constant [2 x i32] [i32 -3, i32 -4]
69; CHECK: @const.array = constant [2 x i32] [i32 -3, i32 -4]
70@const.vector = constant <2 x i32> <i32 -5, i32 -6>
71; CHECK: @const.vector = constant <2 x i32> <i32 -5, i32 -6>
72
73;; Global Variables
74; Format: [@<GlobalVarName> =] [Linkage] [Visibility] [DLLStorageClass]
75;         [ThreadLocal] [unnamed_addr] [AddrSpace] [ExternallyInitialized]
76;         <global | constant> <Type> [<InitializerConstant>]
77;         [, section "name"] [, align <Alignment>]
78
79; Global Variables -- Simple
80@g1 = global i32 0
81; CHECK: @g1 = global i32 0
82@g2 = constant i32 0
83; CHECK: @g2 = constant i32 0
84
85; Global Variables -- Linkage
86@g.private = private global i32 0
87; CHECK: @g.private = private global i32 0
88@g.internal = internal global i32 0
89; CHECK: @g.internal = internal global i32 0
90@g.available_externally = available_externally global i32 0
91; CHECK: @g.available_externally = available_externally global i32 0
92@g.linkonce = linkonce global i32 0
93; CHECK: @g.linkonce = linkonce global i32 0
94@g.weak = weak global i32 0
95; CHECK: @g.weak = weak global i32 0
96@g.common = common global i32 0
97; CHECK: @g.common = common global i32 0
98@g.appending = appending global [4 x i8] c"test"
99; CHECK: @g.appending = appending global [4 x i8] c"test"
100@g.extern_weak = extern_weak global i32
101; CHECK: @g.extern_weak = extern_weak global i32
102@g.linkonce_odr = linkonce_odr global i32 0
103; CHECK: @g.linkonce_odr = linkonce_odr global i32 0
104@g.weak_odr = weak_odr global i32 0
105; CHECK: @g.weak_odr = weak_odr global i32 0
106@g.external = external global i32
107; CHECK: @g.external = external global i32
108
109; Global Variables -- Visibility
110@g.default = default global i32 0
111; CHECK: @g.default = global i32 0
112@g.hidden = hidden global i32 0
113; CHECK: @g.hidden = hidden global i32 0
114@g.protected = protected global i32 0
115; CHECK: @g.protected = protected global i32 0
116
117; Global Variables -- DLLStorageClass
118@g.dlldefault = default global i32 0
119; CHECK: @g.dlldefault = global i32 0
120@g.dllimport = external dllimport global i32
121; CHECK: @g.dllimport = external dllimport global i32
122@g.dllexport = dllexport global i32 0
123; CHECK: @g.dllexport = dllexport global i32 0
124
125; Global Variables -- ThreadLocal
126@g.notthreadlocal = global i32 0
127; CHECK: @g.notthreadlocal = global i32 0
128@g.generaldynamic = thread_local global i32 0
129; CHECK: @g.generaldynamic = thread_local global i32 0
130@g.localdynamic = thread_local(localdynamic) global i32 0
131; CHECK: @g.localdynamic = thread_local(localdynamic) global i32 0
132@g.initialexec = thread_local(initialexec) global i32 0
133; CHECK: @g.initialexec = thread_local(initialexec) global i32 0
134@g.localexec = thread_local(localexec) global i32 0
135; CHECK: @g.localexec = thread_local(localexec) global i32 0
136
137; Global Variables -- unnamed_addr
138@g.unnamed_addr = unnamed_addr global i32 0
139; CHECK: @g.unnamed_addr = unnamed_addr global i32 0
140
141; Global Variables -- AddrSpace
142@g.addrspace = addrspace(1) global i32 0
143; CHECK: @g.addrspace = addrspace(1) global i32 0
144
145; Global Variables -- ExternallyInitialized
146@g.externally_initialized = external externally_initialized global i32
147; CHECK: @g.externally_initialized = external externally_initialized global i32
148
149; Global Variables -- section
150@g.section = global i32 0, section "_DATA"
151; CHECK: @g.section = global i32 0, section "_DATA"
152
153; Global Variables -- align
154@g.align = global i32 0, align 4
155; CHECK: @g.align = global i32 0, align 4
156
157; Global Variables -- Intrinsics
158%pri.func.data = type { i32, void ()*, i8* }
159@g.used1 = global i32 0
160@g.used2 = global i32 0
161@g.used3 = global i8 0
162declare void @g.f1()
163@llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
164; CHECK: @llvm.used = appending global [1 x i32*] [i32* @g.used1], section "llvm.metadata"
165@llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
166; CHECK: @llvm.compiler.used = appending global [1 x i32*] [i32* @g.used2], section "llvm.metadata"
167@llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
168; CHECK: @llvm.global_ctors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
169@llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
170; CHECK: @llvm.global_dtors = appending global [1 x %pri.func.data] [%pri.func.data { i32 0, void ()* @g.f1, i8* @g.used3 }], section "llvm.metadata"
171
172;; Aliases
173; Format: @<Name> = [Linkage] [Visibility] [DLLStorageClass] [ThreadLocal]
174;                   [unnamed_addr] alias <AliaseeTy> @<Aliasee>
175
176; Aliases -- Linkage
177@a.private = private alias i32* @g.private
178; CHECK: @a.private = private alias i32, i32* @g.private
179@a.internal = internal alias i32* @g.internal
180; CHECK: @a.internal = internal alias i32, i32* @g.internal
181@a.linkonce = linkonce alias i32* @g.linkonce
182; CHECK: @a.linkonce = linkonce alias i32, i32* @g.linkonce
183@a.weak = weak alias i32* @g.weak
184; CHECK: @a.weak = weak alias i32, i32* @g.weak
185@a.linkonce_odr = linkonce_odr alias i32* @g.linkonce_odr
186; CHECK: @a.linkonce_odr = linkonce_odr alias i32, i32* @g.linkonce_odr
187@a.weak_odr = weak_odr alias i32* @g.weak_odr
188; CHECK: @a.weak_odr = weak_odr alias i32, i32* @g.weak_odr
189@a.external = external alias i32* @g1
190; CHECK: @a.external = alias i32, i32* @g1
191
192; Aliases -- Visibility
193@a.default = default alias i32* @g.default
194; CHECK: @a.default = alias i32, i32* @g.default
195@a.hidden = hidden alias i32* @g.hidden
196; CHECK: @a.hidden = hidden alias i32, i32* @g.hidden
197@a.protected = protected alias i32* @g.protected
198; CHECK: @a.protected = protected alias i32, i32* @g.protected
199
200; Aliases -- DLLStorageClass
201@a.dlldefault = default alias i32* @g.dlldefault
202; CHECK: @a.dlldefault = alias i32, i32* @g.dlldefault
203@a.dllimport = dllimport alias i32* @g1
204; CHECK: @a.dllimport = dllimport alias i32, i32* @g1
205@a.dllexport = dllexport alias i32* @g.dllexport
206; CHECK: @a.dllexport = dllexport alias i32, i32* @g.dllexport
207
208; Aliases -- ThreadLocal
209@a.notthreadlocal = alias i32* @g.notthreadlocal
210; CHECK: @a.notthreadlocal = alias i32, i32* @g.notthreadlocal
211@a.generaldynamic = thread_local alias i32* @g.generaldynamic
212; CHECK: @a.generaldynamic = thread_local alias i32, i32* @g.generaldynamic
213@a.localdynamic = thread_local(localdynamic) alias i32* @g.localdynamic
214; CHECK: @a.localdynamic = thread_local(localdynamic) alias i32, i32* @g.localdynamic
215@a.initialexec = thread_local(initialexec) alias i32* @g.initialexec
216; CHECK: @a.initialexec = thread_local(initialexec) alias i32, i32* @g.initialexec
217@a.localexec = thread_local(localexec) alias i32* @g.localexec
218; CHECK: @a.localexec = thread_local(localexec) alias i32, i32* @g.localexec
219
220; Aliases -- unnamed_addr
221@a.unnamed_addr = unnamed_addr alias i32* @g.unnamed_addr
222; CHECK: @a.unnamed_addr = unnamed_addr alias i32, i32* @g.unnamed_addr
223
224;; Functions
225; Format: define [linkage] [visibility] [DLLStorageClass]
226;         [cconv] [ret attrs]
227;         <ResultType> @<FunctionName> ([argument list])
228;         [unnamed_addr] [fn Attrs] [section "name"] [comdat [($name)]]
229;         [align N] [gc] [prefix Constant]
230;         { ... }
231
232; Functions -- Simple
233declare void @f1 ()
234; CHECK: declare void @f1()
235
236define void @f2 () {
237; CHECK: define void @f2()
238entry:
239  ret void
240}
241
242; Functions -- linkage
243define private void @f.private() {
244; CHECK: define private void @f.private()
245entry:
246  ret void
247}
248define internal void @f.internal() {
249; CHECK: define internal void @f.internal()
250entry:
251  ret void
252}
253define available_externally void @f.available_externally() {
254; CHECK: define available_externally void @f.available_externally()
255entry:
256  ret void
257}
258define linkonce void @f.linkonce() {
259; CHECK: define linkonce void @f.linkonce()
260entry:
261  ret void
262}
263define weak void @f.weak() {
264; CHECK: define weak void @f.weak()
265entry:
266  ret void
267}
268define linkonce_odr void @f.linkonce_odr() {
269; CHECK: define linkonce_odr void @f.linkonce_odr()
270entry:
271  ret void
272}
273define weak_odr void @f.weak_odr() {
274; CHECK: define weak_odr void @f.weak_odr()
275entry:
276  ret void
277}
278declare external void @f.external()
279; CHECK: declare void @f.external()
280declare extern_weak void @f.extern_weak()
281; CHECK: declare extern_weak void @f.extern_weak()
282
283; Functions -- visibility
284declare default void @f.default()
285; CHECK: declare void @f.default()
286declare hidden void @f.hidden()
287; CHECK: declare hidden void @f.hidden()
288declare protected void @f.protected()
289; CHECK: declare protected void @f.protected()
290
291; Functions -- DLLStorageClass
292declare dllimport void @f.dllimport()
293; CHECK: declare dllimport void @f.dllimport()
294declare dllexport void @f.dllexport()
295; CHECK: declare dllexport void @f.dllexport()
296
297; Functions -- cconv (Calling conventions)
298declare ccc void @f.ccc()
299; CHECK: declare void @f.ccc()
300declare fastcc void @f.fastcc()
301; CHECK: declare fastcc void @f.fastcc()
302declare coldcc void @f.coldcc()
303; CHECK: declare coldcc void @f.coldcc()
304declare cc10 void @f.cc10()
305; CHECK: declare ghccc void @f.cc10()
306declare ghccc void @f.ghccc()
307; CHECK: declare ghccc void @f.ghccc()
308declare cc11 void @f.cc11()
309; CHECK: declare cc11 void @f.cc11()
310declare webkit_jscc void @f.webkit_jscc()
311; CHECK: declare webkit_jscc void @f.webkit_jscc()
312declare anyregcc void @f.anyregcc()
313; CHECK: declare anyregcc void @f.anyregcc()
314declare preserve_mostcc void @f.preserve_mostcc()
315; CHECK: declare preserve_mostcc void @f.preserve_mostcc()
316declare preserve_allcc void @f.preserve_allcc()
317; CHECK: declare preserve_allcc void @f.preserve_allcc()
318declare cc64 void @f.cc64()
319; CHECK: declare x86_stdcallcc void @f.cc64()
320declare x86_stdcallcc void @f.x86_stdcallcc()
321; CHECK: declare x86_stdcallcc void @f.x86_stdcallcc()
322declare cc65 void @f.cc65()
323; CHECK: declare x86_fastcallcc void @f.cc65()
324declare x86_fastcallcc void @f.x86_fastcallcc()
325; CHECK: declare x86_fastcallcc void @f.x86_fastcallcc()
326declare cc66 void @f.cc66()
327; CHECK: declare arm_apcscc void @f.cc66()
328declare arm_apcscc void @f.arm_apcscc()
329; CHECK: declare arm_apcscc void @f.arm_apcscc()
330declare cc67 void @f.cc67()
331; CHECK: declare arm_aapcscc void @f.cc67()
332declare arm_aapcscc void @f.arm_aapcscc()
333; CHECK: declare arm_aapcscc void @f.arm_aapcscc()
334declare cc68 void @f.cc68()
335; CHECK: declare arm_aapcs_vfpcc void @f.cc68()
336declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
337; CHECK: declare arm_aapcs_vfpcc void @f.arm_aapcs_vfpcc()
338declare cc69 void @f.cc69()
339; CHECK: declare msp430_intrcc void @f.cc69()
340declare msp430_intrcc void @f.msp430_intrcc()
341; CHECK: declare msp430_intrcc void @f.msp430_intrcc()
342declare cc70 void @f.cc70()
343; CHECK: declare x86_thiscallcc void @f.cc70()
344declare x86_thiscallcc void @f.x86_thiscallcc()
345; CHECK: declare x86_thiscallcc void @f.x86_thiscallcc()
346declare cc71 void @f.cc71()
347; CHECK: declare ptx_kernel void @f.cc71()
348declare ptx_kernel void @f.ptx_kernel()
349; CHECK: declare ptx_kernel void @f.ptx_kernel()
350declare cc72 void @f.cc72()
351; CHECK: declare ptx_device void @f.cc72()
352declare ptx_device void @f.ptx_device()
353; CHECK: declare ptx_device void @f.ptx_device()
354declare cc75 void @f.cc75()
355; CHECK: declare spir_func void @f.cc75()
356declare spir_func void @f.spir_func()
357; CHECK: declare spir_func void @f.spir_func()
358declare cc76 void @f.cc76()
359; CHECK: declare spir_kernel void @f.cc76()
360declare spir_kernel void @f.spir_kernel()
361; CHECK: declare spir_kernel void @f.spir_kernel()
362declare cc77 void @f.cc77()
363; CHECK: declare intel_ocl_bicc void @f.cc77()
364declare intel_ocl_bicc void @f.intel_ocl_bicc()
365; CHECK: declare intel_ocl_bicc void @f.intel_ocl_bicc()
366declare cc78 void @f.cc78()
367; CHECK: declare x86_64_sysvcc void @f.cc78()
368declare x86_64_sysvcc void @f.x86_64_sysvcc()
369; CHECK: declare x86_64_sysvcc void @f.x86_64_sysvcc()
370declare cc79 void @f.cc79()
371; CHECK: declare x86_64_win64cc void @f.cc79()
372declare x86_64_win64cc void @f.x86_64_win64cc()
373; CHECK: declare x86_64_win64cc void @f.x86_64_win64cc()
374declare cc80 void @f.cc80()
375; CHECK: declare x86_vectorcallcc void @f.cc80()
376declare x86_vectorcallcc void @f.x86_vectorcallcc()
377; CHECK: declare x86_vectorcallcc void @f.x86_vectorcallcc()
378declare cc1023 void @f.cc1023()
379; CHECK: declare cc1023 void @f.cc1023()
380
381; Functions -- ret attrs (Return attributes)
382declare zeroext i64 @f.zeroext()
383; CHECK: declare zeroext i64 @f.zeroext()
384declare signext i64 @f.signext()
385; CHECK: declare signext i64 @f.signext()
386declare inreg i32* @f.inreg()
387; CHECK: declare inreg i32* @f.inreg()
388declare noalias i32* @f.noalias()
389; CHECK: declare noalias i32* @f.noalias()
390declare nonnull i32* @f.nonnull()
391; CHECK: declare nonnull i32* @f.nonnull()
392declare dereferenceable(4) i32* @f.dereferenceable4()
393; CHECK: declare dereferenceable(4) i32* @f.dereferenceable4()
394declare dereferenceable(8) i32* @f.dereferenceable8()
395; CHECK: declare dereferenceable(8) i32* @f.dereferenceable8()
396declare dereferenceable(16) i32* @f.dereferenceable16()
397; CHECK: declare dereferenceable(16) i32* @f.dereferenceable16()
398
399; Functions -- Parameter attributes
400declare void @f.param.zeroext(i8 zeroext)
401; CHECK: declare void @f.param.zeroext(i8 zeroext)
402declare void @f.param.signext(i8 signext)
403; CHECK: declare void @f.param.signext(i8 signext)
404declare void @f.param.inreg(i8 inreg)
405; CHECK: declare void @f.param.inreg(i8 inreg)
406declare void @f.param.byval({ i8, i8 }* byval)
407; CHECK: declare void @f.param.byval({ i8, i8 }* byval)
408declare void @f.param.inalloca(i8* inalloca)
409; CHECK: declare void @f.param.inalloca(i8* inalloca)
410declare void @f.param.sret(i8* sret)
411; CHECK: declare void @f.param.sret(i8* sret)
412declare void @f.param.noalias(i8* noalias)
413; CHECK: declare void @f.param.noalias(i8* noalias)
414declare void @f.param.nocapture(i8* nocapture)
415; CHECK: declare void @f.param.nocapture(i8* nocapture)
416declare void @f.param.nest(i8* nest)
417; CHECK: declare void @f.param.nest(i8* nest)
418declare i8* @f.param.returned(i8* returned)
419; CHECK: declare i8* @f.param.returned(i8* returned)
420declare void @f.param.nonnull(i8* nonnull)
421; CHECK: declare void @f.param.nonnull(i8* nonnull)
422declare void @f.param.dereferenceable(i8* dereferenceable(4))
423; CHECK: declare void @f.param.dereferenceable(i8* dereferenceable(4))
424
425; Functions -- unnamed_addr
426declare void @f.unnamed_addr() unnamed_addr
427; CHECK: declare void @f.unnamed_addr() unnamed_addr
428
429; Functions -- fn Attrs (Function attributes)
430declare void @f.alignstack4() alignstack(4)
431; CHECK: declare void @f.alignstack4() #0
432declare void @f.alignstack8() alignstack(8)
433; CHECK: declare void @f.alignstack8() #1
434declare void @f.alwaysinline() alwaysinline
435; CHECK: declare void @f.alwaysinline() #2
436declare void @f.cold() cold
437; CHECK: declare void @f.cold() #3
438declare void @f.inlinehint() inlinehint
439; CHECK: declare void @f.inlinehint() #4
440declare void @f.jumptable() unnamed_addr jumptable
441; CHECK: declare void @f.jumptable() unnamed_addr #5
442declare void @f.minsize() minsize
443; CHECK: declare void @f.minsize() #6
444declare void @f.naked() naked
445; CHECK: declare void @f.naked() #7
446declare void @f.nobuiltin() nobuiltin
447; CHECK: declare void @f.nobuiltin() #8
448declare void @f.noduplicate() noduplicate
449; CHECK: declare void @f.noduplicate() #9
450declare void @f.noimplicitfloat() noimplicitfloat
451; CHECK: declare void @f.noimplicitfloat() #10
452declare void @f.noinline() noinline
453; CHECK: declare void @f.noinline() #11
454declare void @f.nonlazybind() nonlazybind
455; CHECK: declare void @f.nonlazybind() #12
456declare void @f.noredzone() noredzone
457; CHECK: declare void @f.noredzone() #13
458declare void @f.noreturn() noreturn
459; CHECK: declare void @f.noreturn() #14
460declare void @f.nounwind() nounwind
461; CHECK: declare void @f.nounwind() #15
462declare void @f.optnone() noinline optnone
463; CHECK: declare void @f.optnone() #16
464declare void @f.optsize() optsize
465; CHECK: declare void @f.optsize() #17
466declare void @f.readnone() readnone
467; CHECK: declare void @f.readnone() #18
468declare void @f.readonly() readonly
469; CHECK: declare void @f.readonly() #19
470declare void @f.returns_twice() returns_twice
471; CHECK: declare void @f.returns_twice() #20
472declare void @f.sanitize_address() sanitize_address
473; CHECK: declare void @f.sanitize_address() #21
474declare void @f.sanitize_memory() sanitize_memory
475; CHECK: declare void @f.sanitize_memory() #22
476declare void @f.sanitize_thread() sanitize_thread
477; CHECK: declare void @f.sanitize_thread() #23
478declare void @f.ssp() ssp
479; CHECK: declare void @f.ssp() #24
480declare void @f.sspreq() sspreq
481; CHECK: declare void @f.sspreq() #25
482declare void @f.sspstrong() sspstrong
483; CHECK: declare void @f.sspstrong() #26
484declare void @f.uwtable() uwtable
485; CHECK: declare void @f.uwtable() #27
486declare void @f.kvpair() "cpu"="cortex-a8"
487; CHECK:declare void @f.kvpair() #28
488
489; Functions -- section
490declare void @f.section() section "80"
491; CHECK: declare void @f.section() section "80"
492
493; Functions -- comdat
494define void @f.comdat_any() comdat($comdat.any) {
495; CHECK: define void @f.comdat_any() comdat($comdat.any)
496entry:
497  ret void
498}
499define void @f.comdat_exactmatch() comdat($comdat.exactmatch) {
500; CHECK: define void @f.comdat_exactmatch() comdat($comdat.exactmatch)
501entry:
502  ret void
503}
504define void @f.comdat_largest() comdat($comdat.largest) {
505; CHECK: define void @f.comdat_largest() comdat($comdat.largest)
506entry:
507  ret void
508}
509define void @f.comdat_noduplicates() comdat($comdat.noduplicates) {
510; CHECK: define void @f.comdat_noduplicates() comdat($comdat.noduplicates)
511entry:
512  ret void
513}
514define void @f.comdat_samesize() comdat($comdat.samesize) {
515; CHECK: define void @f.comdat_samesize() comdat($comdat.samesize)
516entry:
517  ret void
518}
519
520; Functions -- align
521declare void @f.align2() align 2
522; CHECK: declare void @f.align2() align 2
523declare void @f.align4() align 4
524; CHECK: declare void @f.align4() align 4
525declare void @f.align8() align 8
526; CHECK: declare void @f.align8() align 8
527
528; Functions -- GC
529declare void @f.gcshadow() gc "shadow-stack"
530; CHECK: declare void @f.gcshadow() gc "shadow-stack"
531
532; Functions -- Prefix data
533declare void @f.prefixi32() prefix i32 1684365668
534; CHECK: declare void @f.prefixi32() prefix i32 1684365668
535declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
536; CHECK: declare void @f.prefixarray() prefix [4 x i32] [i32 0, i32 1, i32 2, i32 3]
537
538;; Atomic Memory Ordering Constraints
539define void @atomics(i32* %word) {
540  %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
541  ; CHECK: %cmpxchg.0 = cmpxchg i32* %word, i32 0, i32 4 monotonic monotonic
542  %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
543  ; CHECK: %cmpxchg.1 = cmpxchg i32* %word, i32 0, i32 5 acq_rel monotonic
544  %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
545  ; CHECK: %cmpxchg.2 = cmpxchg i32* %word, i32 0, i32 6 acquire monotonic
546  %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
547  ; CHECK: %cmpxchg.3 = cmpxchg i32* %word, i32 0, i32 7 release monotonic
548  %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
549  ; CHECK: %cmpxchg.4 = cmpxchg i32* %word, i32 0, i32 8 seq_cst monotonic
550  %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
551  ; CHECK: %cmpxchg.5 = cmpxchg weak i32* %word, i32 0, i32 9 seq_cst monotonic
552  %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
553  ; CHECK: %cmpxchg.6 = cmpxchg volatile i32* %word, i32 0, i32 10 seq_cst monotonic
554  %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
555  ; CHECK: %cmpxchg.7 = cmpxchg weak volatile i32* %word, i32 0, i32 11 singlethread seq_cst monotonic
556  %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
557  ; CHECK: %atomicrmw.xchg = atomicrmw xchg i32* %word, i32 12 monotonic
558  %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
559  ; CHECK: %atomicrmw.add = atomicrmw add i32* %word, i32 13 monotonic
560  %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
561  ; CHECK: %atomicrmw.sub = atomicrmw sub i32* %word, i32 14 monotonic
562  %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
563  ; CHECK: %atomicrmw.and = atomicrmw and i32* %word, i32 15 monotonic
564  %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
565  ; CHECK: %atomicrmw.nand = atomicrmw nand i32* %word, i32 16 monotonic
566  %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
567  ; CHECK: %atomicrmw.or = atomicrmw or i32* %word, i32 17 monotonic
568  %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
569  ; CHECK: %atomicrmw.xor = atomicrmw xor i32* %word, i32 18 monotonic
570  %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
571  ; CHECK: %atomicrmw.max = atomicrmw max i32* %word, i32 19 monotonic
572  %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
573  ; CHECK: %atomicrmw.min = atomicrmw volatile min i32* %word, i32 20 monotonic
574  %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
575  ; CHECK: %atomicrmw.umax = atomicrmw umax i32* %word, i32 21 singlethread monotonic
576  %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
577  ; CHECK: %atomicrmw.umin = atomicrmw volatile umin i32* %word, i32 22 singlethread monotonic
578  fence acquire
579  ; CHECK: fence acquire
580  fence release
581  ; CHECK: fence release
582  fence acq_rel
583  ; CHECK: fence acq_rel
584  fence singlethread seq_cst
585  ; CHECK: fence singlethread seq_cst
586
587  ; XXX: The parser spits out the load type here.
588  %ld.1 = load atomic i32* %word monotonic, align 4
589  ; CHECK: %ld.1 = load atomic i32, i32* %word monotonic, align 4
590  %ld.2 = load atomic volatile i32* %word acquire, align 8
591  ; CHECK: %ld.2 = load atomic volatile i32, i32* %word acquire, align 8
592  %ld.3 = load atomic volatile i32* %word singlethread seq_cst, align 16
593  ; CHECK: %ld.3 = load atomic volatile i32, i32* %word singlethread seq_cst, align 16
594
595  store atomic i32 23, i32* %word monotonic, align 4
596  ; CHECK: store atomic i32 23, i32* %word monotonic, align 4
597  store atomic volatile i32 24, i32* %word monotonic, align 4
598  ; CHECK: store atomic volatile i32 24, i32* %word monotonic, align 4
599  store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
600  ; CHECK: store atomic volatile i32 25, i32* %word singlethread monotonic, align 4
601  ret void
602}
603
604;; Fast Math Flags
605define void @fastmathflags(float %op1, float %op2) {
606  %f.nnan = fadd nnan float %op1, %op2
607  ; CHECK: %f.nnan = fadd nnan float %op1, %op2
608  %f.ninf = fadd ninf float %op1, %op2
609  ; CHECK: %f.ninf = fadd ninf float %op1, %op2
610  %f.nsz = fadd nsz float %op1, %op2
611  ; CHECK: %f.nsz = fadd nsz float %op1, %op2
612  %f.arcp = fadd arcp float %op1, %op2
613  ; CHECK: %f.arcp = fadd arcp float %op1, %op2
614  %f.fast = fadd fast float %op1, %op2
615  ; CHECK: %f.fast = fadd fast float %op1, %op2
616  ret void
617}
618
619;; Type System
620%opaquety = type opaque
621define void @typesystem() {
622  %p0 = bitcast i8* null to i32 (i32)*
623  ; CHECK: %p0 = bitcast i8* null to i32 (i32)*
624  %p1 = bitcast i8* null to void (i8*)*
625  ; CHECK: %p1 = bitcast i8* null to void (i8*)*
626  %p2 = bitcast i8* null to i32 (i8*, ...)*
627  ; CHECK: %p2 = bitcast i8* null to i32 (i8*, ...)*
628  %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
629  ; CHECK: %p3 = bitcast i8* null to { i32, i8 } (i8*, ...)*
630  %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
631  ; CHECK: %p4 = bitcast i8* null to <{ i32, i8 }> (i8*, ...)*
632  %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
633  ; CHECK: %p5 = bitcast i8* null to <{ i32, i8 }> (<{ i8*, i64 }>*, ...)*
634
635  %t0 = alloca i1942652
636  ; CHECK: %t0 = alloca i1942652
637  %t1 = alloca half
638  ; CHECK: %t1 = alloca half
639  %t2 = alloca float
640  ; CHECK: %t2 = alloca float
641  %t3 = alloca double
642  ; CHECK: %t3 = alloca double
643  %t4 = alloca fp128
644  ; CHECK: %t4 = alloca fp128
645  %t5 = alloca x86_fp80
646  ; CHECK: %t5 = alloca x86_fp80
647  %t6 = alloca ppc_fp128
648  ; CHECK: %t6 = alloca ppc_fp128
649  %t7 = alloca x86_mmx
650  ; CHECK: %t7 = alloca x86_mmx
651  %t8 = alloca %opaquety*
652  ; CHECK: %t8 = alloca %opaquety*
653
654  ret void
655}
656
657;; Inline Assembler Expressions
658define void @inlineasm(i32 %arg) {
659  call i32 asm "bswap $0", "=r,r"(i32 %arg)
660  ; CHECK: call i32 asm "bswap $0", "=r,r"(i32 %arg)
661  call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
662  ; CHECK: call i32 asm sideeffect "blt $1, $2, $3", "=r,r,rm"(i32 %arg, i32 %arg)
663  ret void
664}
665
666;; Instructions
667
668; Instructions -- Terminators
669define void @instructions.terminators(i8 %val) { ; XXX: landingpad changed.
670; CHECK: define void @instructions.terminators(i8 %val) personality i32 ()* @personality_handler
671
672  br i1 false, label %iftrue, label %iffalse
673  ; CHECK: br i1 false, label %iftrue, label %iffalse
674  br label %iftrue
675  ; CHECK: br label %iftrue
676iftrue:
677  ret void
678  ; CHECK: ret void
679iffalse:
680
681  switch i8 %val, label %defaultdest [
682  ; CHECK: switch i8 %val, label %defaultdest [
683         i8 0, label %defaultdest.0
684         ; CHECK: i8 0, label %defaultdest.0
685         i8 1, label %defaultdest.1
686         ; CHECK: i8 1, label %defaultdest.1
687         i8 2, label %defaultdest.2
688         ; CHECK: i8 2, label %defaultdest.2
689  ]
690  ; CHECK: ]
691defaultdest:
692  ret void
693defaultdest.0:
694  ret void
695defaultdest.1:
696  ret void
697defaultdest.2:
698
699  indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
700  ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2]
701  indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
702  ; CHECK: indirectbr i8* blockaddress(@instructions.terminators, %defaultdest.2), [label %defaultdest.2, label %defaultdest.2]
703
704  invoke fastcc void @f.fastcc()
705  ; CHECK: invoke fastcc void @f.fastcc()
706         to label %defaultdest unwind label %exc
707         ; CHECK: to label %defaultdest unwind label %exc
708exc:
709  %cleanup = landingpad i32 personality i32()* @personality_handler cleanup
710
711  resume i32 undef
712  ; CHECK: resume i32 undef
713  unreachable
714  ; CHECK: unreachable
715
716  ret void
717}
718
719; Instructions -- Binary Operations
720define void @instructions.binops(i8 %op1, i8 %op2) {
721  ; nuw x nsw
722  add i8 %op1, %op2
723  ; CHECK: add i8 %op1, %op2
724  add nuw i8 %op1, %op2
725  ; CHECK: add nuw i8 %op1, %op2
726  add nsw i8 %op1, %op2
727  ; CHECK: add nsw i8 %op1, %op2
728  add nuw nsw i8 %op1, %op2
729  ; CHECK: add nuw nsw i8 %op1, %op2
730  sub i8 %op1, %op2
731  ; CHECK: sub i8 %op1, %op2
732  sub nuw i8 %op1, %op2
733  ; CHECK: sub nuw i8 %op1, %op2
734  sub nsw i8 %op1, %op2
735  ; CHECK: sub nsw i8 %op1, %op2
736  sub nuw nsw i8 %op1, %op2
737  ; CHECK: sub nuw nsw i8 %op1, %op2
738  mul i8 %op1, %op2
739  ; CHECK: mul i8 %op1, %op2
740  mul nuw i8 %op1, %op2
741  ; CHECK: mul nuw i8 %op1, %op2
742  mul nsw i8 %op1, %op2
743  ; CHECK: mul nsw i8 %op1, %op2
744  mul nuw nsw i8 %op1, %op2
745  ; CHECK: mul nuw nsw i8 %op1, %op2
746
747  ; exact
748  udiv i8 %op1, %op2
749  ; CHECK: udiv i8 %op1, %op2
750  udiv exact i8 %op1, %op2
751  ; CHECK: udiv exact i8 %op1, %op2
752  sdiv i8 %op1, %op2
753  ; CHECK: sdiv i8 %op1, %op2
754  sdiv exact i8 %op1, %op2
755  ; CHECK: sdiv exact i8 %op1, %op2
756
757  ; none
758  urem i8 %op1, %op2
759  ; CHECK: urem i8 %op1, %op2
760  srem i8 %op1, %op2
761  ; CHECK: srem i8 %op1, %op2
762
763  ret void
764}
765
766; Instructions -- Bitwise Binary Operations
767define void @instructions.bitwise_binops(i8 %op1, i8 %op2) {
768  ; nuw x nsw
769  shl i8 %op1, %op2
770  ; CHECK: shl i8 %op1, %op2
771  shl nuw i8 %op1, %op2
772  ; CHECK: shl nuw i8 %op1, %op2
773  shl nsw i8 %op1, %op2
774  ; CHECK: shl nsw i8 %op1, %op2
775  shl nuw nsw i8 %op1, %op2
776  ; CHECK: shl nuw nsw i8 %op1, %op2
777
778  ; exact
779  lshr i8 %op1, %op2
780  ; CHECK: lshr i8 %op1, %op2
781  lshr exact i8 %op1, %op2
782  ; CHECK: lshr exact i8 %op1, %op2
783  ashr i8 %op1, %op2
784  ; CHECK: ashr i8 %op1, %op2
785  ashr exact i8 %op1, %op2
786  ; CHECK: ashr exact i8 %op1, %op2
787
788  ; none
789  and i8 %op1, %op2
790  ; CHECK: and i8 %op1, %op2
791  or i8 %op1, %op2
792  ; CHECK: or i8 %op1, %op2
793  xor i8 %op1, %op2
794  ; CHECK: xor i8 %op1, %op2
795
796  ret void
797}
798
799; Instructions -- Vector Operations
800define void @instructions.vectorops(<4 x float> %vec, <4 x float> %vec2) {
801  extractelement <4 x float> %vec, i8 0
802  ; CHECK: extractelement <4 x float> %vec, i8 0
803  insertelement <4 x float> %vec, float 3.500000e+00, i8 0
804  ; CHECK: insertelement <4 x float> %vec, float 3.500000e+00, i8 0
805  shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
806  ; CHECK: shufflevector <4 x float> %vec, <4 x float> %vec2, <2 x i32> zeroinitializer
807
808  ret void
809}
810
811; Instructions -- Aggregate Operations
812define void @instructions.aggregateops({ i8, i32 } %up, <{ i8, i32 }> %p,
813                                       [3 x i8] %arr, { i8, { i32 }} %n,
814                                       <2 x i8*> %pvec, <2 x i64> %offsets) {
815  extractvalue { i8, i32 } %up, 0
816  ; CHECK: extractvalue { i8, i32 } %up, 0
817  extractvalue <{ i8, i32 }> %p, 1
818  ; CHECK: extractvalue <{ i8, i32 }> %p, 1
819  extractvalue [3 x i8] %arr, 2
820  ; CHECK: extractvalue [3 x i8] %arr, 2
821  extractvalue { i8, { i32 } } %n, 1, 0
822  ; CHECK: extractvalue { i8, { i32 } } %n, 1, 0
823
824  insertvalue { i8, i32 } %up, i8 1, 0
825  ; CHECK: insertvalue { i8, i32 } %up, i8 1, 0
826  insertvalue <{ i8, i32 }> %p, i32 2, 1
827  ; CHECK: insertvalue <{ i8, i32 }> %p, i32 2, 1
828  insertvalue [3 x i8] %arr, i8 0, 0
829  ; CHECK: insertvalue [3 x i8] %arr, i8 0, 0
830  insertvalue { i8, { i32 } } %n, i32 0, 1, 0
831  ; CHECK: insertvalue { i8, { i32 } } %n, i32 0, 1, 0
832
833  %up.ptr = alloca { i8, i32 }
834  %p.ptr = alloca <{ i8, i32 }>
835  %arr.ptr = alloca [3 x i8]
836  %n.ptr = alloca { i8, { i32 } }
837
838  ; XXX: The parser spits out the load type here.
839  getelementptr { i8, i32 }* %up.ptr, i8 0
840  ; CHECK: getelementptr { i8, i32 }, { i8, i32 }* %up.ptr, i8 0
841  getelementptr <{ i8, i32 }>* %p.ptr, i8 1
842  ; CHECK: getelementptr <{ i8, i32 }>, <{ i8, i32 }>* %p.ptr, i8 1
843  getelementptr [3 x i8]* %arr.ptr, i8 2
844  ; CHECK: getelementptr [3 x i8], [3 x i8]* %arr.ptr, i8 2
845  getelementptr { i8, { i32 } }* %n.ptr, i32 0, i32 1
846  ; CHECK: getelementptr { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 0, i32 1
847  getelementptr inbounds { i8, { i32 } }* %n.ptr, i32 1, i32 0
848  ; CHECK: getelementptr inbounds { i8, { i32 } }, { i8, { i32 } }* %n.ptr, i32 1, i32 0
849  getelementptr <2 x i8*> %pvec, <2 x i64> %offsets
850  ; CHECK: getelementptr i8, <2 x i8*> %pvec, <2 x i64> %offsets
851
852  ret void
853}
854
855; Instructions -- Memory Access and Addressing Operations
856!7 = !{i32 1}
857!8 = !{}
858!9 = !{i64 4}
859define void @instructions.memops(i32** %base) {
860  alloca i32, i8 4, align 4
861  ; CHECK: alloca i32, i8 4, align 4
862  alloca inalloca i32, i8 4, align 4
863  ; CHECK: alloca inalloca i32, i8 4, align 4
864
865  load i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9
866  ; CHECK: load i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9
867  load volatile i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9
868  ; CHECK: load volatile i32*, i32** %base, align 8, !invariant.load !7, !nontemporal !8, !nonnull !7, !dereferenceable !9
869
870  store i32* null, i32** %base, align 4, !nontemporal !8
871  ; CHECK: store i32* null, i32** %base, align 4, !nontemporal !8
872  store volatile i32* null, i32** %base, align 4, !nontemporal !8
873  ; CHECK: store volatile i32* null, i32** %base, align 4, !nontemporal !8
874
875  ret void
876}
877
878; Instructions -- Conversion Operations
879define void @instructions.conversions() {
880  trunc i32 -1 to i1
881  ; CHECK: trunc i32 -1 to i1
882  zext i32 -1 to i64
883  ; CHECK: zext i32 -1 to i64
884  sext i32 -1 to i64
885  ; CHECK: sext i32 -1 to i64
886  fptrunc float undef to half
887  ; CHECK: fptrunc float undef to half
888  fpext half undef to float
889  ; CHECK: fpext half undef to float
890  fptoui float undef to i32
891  ; CHECK: fptoui float undef to i32
892  fptosi float undef to i32
893  ; CHECK: fptosi float undef to i32
894  uitofp i32 1 to float
895  ; CHECK: uitofp i32 1 to float
896  sitofp i32 -1 to float
897  ; CHECK: sitofp i32 -1 to float
898  ptrtoint i8* null to i64
899  ; CHECK: ptrtoint i8* null to i64
900  inttoptr i64 0 to i8*
901  ; CHECK: inttoptr i64 0 to i8*
902  bitcast i32 0 to i32
903  ; CHECK: bitcast i32 0 to i32
904  addrspacecast i32* null to i32 addrspace(1)*
905  ; CHECK: addrspacecast i32* null to i32 addrspace(1)*
906
907  ret void
908}
909
910; Instructions -- Other Operations
911define void @instructions.other(i32 %op1, i32 %op2, half %fop1, half %fop2) {
912entry:
913  icmp eq  i32 %op1, %op2
914  ; CHECK: icmp eq  i32 %op1, %op2
915  icmp ne  i32 %op1, %op2
916  ; CHECK: icmp ne  i32 %op1, %op2
917  icmp ugt i32 %op1, %op2
918  ; CHECK: icmp ugt i32 %op1, %op2
919  icmp uge i32 %op1, %op2
920  ; CHECK: icmp uge i32 %op1, %op2
921  icmp ult i32 %op1, %op2
922  ; CHECK: icmp ult i32 %op1, %op2
923  icmp ule i32 %op1, %op2
924  ; CHECK: icmp ule i32 %op1, %op2
925  icmp sgt i32 %op1, %op2
926  ; CHECK: icmp sgt i32 %op1, %op2
927  icmp sge i32 %op1, %op2
928  ; CHECK: icmp sge i32 %op1, %op2
929  icmp slt i32 %op1, %op2
930  ; CHECK: icmp slt i32 %op1, %op2
931  icmp sle i32 %op1, %op2
932  ; CHECK: icmp sle i32 %op1, %op2
933
934  fcmp false half %fop1, %fop2
935  ; CHECK: fcmp false half %fop1, %fop2
936  fcmp oeq   half %fop1, %fop2
937  ; CHECK: fcmp oeq   half %fop1, %fop2
938  fcmp ogt   half %fop1, %fop2
939  ; CHECK: fcmp ogt   half %fop1, %fop2
940  fcmp oge   half %fop1, %fop2
941  ; CHECK: fcmp oge   half %fop1, %fop2
942  fcmp olt   half %fop1, %fop2
943  ; CHECK: fcmp olt   half %fop1, %fop2
944  fcmp ole   half %fop1, %fop2
945  ; CHECK: fcmp ole   half %fop1, %fop2
946  fcmp one   half %fop1, %fop2
947  ; CHECK: fcmp one   half %fop1, %fop2
948  fcmp ord   half %fop1, %fop2
949  ; CHECK: fcmp ord   half %fop1, %fop2
950  fcmp ueq   half %fop1, %fop2
951  ; CHECK: fcmp ueq   half %fop1, %fop2
952  fcmp ugt   half %fop1, %fop2
953  ; CHECK: fcmp ugt   half %fop1, %fop2
954  fcmp uge   half %fop1, %fop2
955  ; CHECK: fcmp uge   half %fop1, %fop2
956  fcmp ult   half %fop1, %fop2
957  ; CHECK: fcmp ult   half %fop1, %fop2
958  fcmp ule   half %fop1, %fop2
959  ; CHECK: fcmp ule   half %fop1, %fop2
960  fcmp une   half %fop1, %fop2
961  ; CHECK: fcmp une   half %fop1, %fop2
962  fcmp uno   half %fop1, %fop2
963  ; CHECK: fcmp uno   half %fop1, %fop2
964  fcmp true  half %fop1, %fop2
965  ; CHECK: fcmp true  half %fop1, %fop2
966
967  br label %exit
968L1:
969  %v1 = add i32 %op1, %op2
970  br label %exit
971L2:
972  %v2 = add i32 %op1, %op2
973  br label %exit
974exit:
975  phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
976  ; CHECK: phi i32 [ %v1, %L1 ], [ %v2, %L2 ], [ %op1, %entry ]
977
978  select i1 true, i32 0, i32 1
979  ; CHECK: select i1 true, i32 0, i32 1
980  select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
981  ; CHECK: select <2 x i1> <i1 true, i1 false>, <2 x i8> <i8 2, i8 3>, <2 x i8> <i8 3, i8 2>
982
983  call void @f.nobuiltin() builtin
984  ; CHECK: call void @f.nobuiltin() #33
985
986  call fastcc noalias i32* @f.noalias() noinline
987  ; CHECK: call fastcc noalias i32* @f.noalias() #11
988  tail call ghccc nonnull i32* @f.nonnull() minsize
989  ; CHECK: tail call ghccc nonnull i32* @f.nonnull() #6
990
991  ret void
992}
993
994define void @instructions.call_musttail(i8* inalloca %val) {
995  musttail call void @f.param.inalloca(i8* inalloca %val)
996  ; CHECK: musttail call void @f.param.inalloca(i8* inalloca %val)
997
998  ret void
999}
1000
1001declare void @llvm.donothing() nounwind readnone
1002
1003declare i32 @personality_handler()
1004
1005define void @instructions.landingpad() {
1006; CHECK: define void @instructions.landingpad() personality i32 ()* @personality_handler
1007
1008  invoke void @llvm.donothing() to label %proceed unwind label %catch1
1009  invoke void @llvm.donothing() to label %proceed unwind label %catch2
1010  invoke void @llvm.donothing() to label %proceed unwind label %catch3
1011  invoke void @llvm.donothing() to label %proceed unwind label %catch4
1012
1013catch1:
1014  landingpad i32
1015  ; CHECK: landingpad i32
1016             personality i32()* @personality_handler
1017             cleanup
1018             ; CHECK: cleanup
1019  br label %proceed
1020
1021catch2:
1022  landingpad i32
1023  ; CHECK: landingpad i32
1024             personality i32()* @personality_handler
1025             cleanup
1026             ; CHECK: cleanup
1027             catch i32* null
1028             ; CHECK: catch i32* null
1029  br label %proceed
1030
1031catch3:
1032  landingpad i32
1033  ; CHECK: landingpad i32
1034             personality i32()* @personality_handler
1035             cleanup
1036             ; CHECK: cleanup
1037             catch i32* null
1038             ; CHECK: catch i32* null
1039             catch i32* null
1040             ; CHECK: catch i32* null
1041  br label %proceed
1042
1043catch4:
1044  landingpad i32
1045  ; CHECK: landingpad i32
1046             personality i32()* @personality_handler
1047             filter [2 x i32] zeroinitializer
1048             ; CHECK: filter [2 x i32] zeroinitializer
1049  br label %proceed
1050
1051proceed:
1052  ret void
1053}
1054
1055;; Intrinsic Functions
1056
1057; Intrinsic Functions -- Variable Argument Handling
1058declare void @llvm.va_start(i8*)
1059declare void @llvm.va_copy(i8*, i8*)
1060declare void @llvm.va_end(i8*)
1061define void @instructions.va_arg(i8* %v, ...) {
1062  %ap = alloca i8*
1063  %ap2 = bitcast i8** %ap to i8*
1064
1065  call void @llvm.va_start(i8* %ap2)
1066  ; CHECK: call void @llvm.va_start(i8* %ap2)
1067
1068  va_arg i8* %ap2, i32
1069  ; CHECK: va_arg i8* %ap2, i32
1070
1071  call void @llvm.va_copy(i8* %v, i8* %ap2)
1072  ; CHECK: call void @llvm.va_copy(i8* %v, i8* %ap2)
1073
1074  call void @llvm.va_end(i8* %ap2)
1075  ; CHECK: call void @llvm.va_end(i8* %ap2)
1076
1077  ret void
1078}
1079
1080; Intrinsic Functions -- Accurate Garbage Collection
1081declare void @llvm.gcroot(i8**, i8*)
1082declare i8* @llvm.gcread(i8*, i8**)
1083declare void @llvm.gcwrite(i8*, i8*, i8**)
1084define void @intrinsics.gc() gc "shadow-stack" {
1085  %ptrloc = alloca i8*
1086  call void @llvm.gcroot(i8** %ptrloc, i8* null)
1087  ; CHECK: call void @llvm.gcroot(i8** %ptrloc, i8* null)
1088
1089  call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1090  ; CHECK: call i8* @llvm.gcread(i8* null, i8** %ptrloc)
1091
1092  %ref = alloca i8
1093  call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1094  ; CHECK: call void @llvm.gcwrite(i8* %ref, i8* null, i8** %ptrloc)
1095
1096  ret void
1097}
1098
1099; Intrinsic Functions -- Code Generation
1100declare i8* @llvm.returnaddress(i32)
1101declare i8* @llvm.frameaddress(i32)
1102declare i32 @llvm.read_register.i32(metadata)
1103declare i64 @llvm.read_register.i64(metadata)
1104declare void @llvm.write_register.i32(metadata, i32)
1105declare void @llvm.write_register.i64(metadata, i64)
1106declare i8* @llvm.stacksave()
1107declare void @llvm.stackrestore(i8*)
1108declare void @llvm.prefetch(i8*, i32, i32, i32)
1109declare void @llvm.pcmarker(i32)
1110declare i64 @llvm.readcyclecounter()
1111declare void @llvm.clear_cache(i8*, i8*)
1112declare void @llvm.instrprof_increment(i8*, i64, i32, i32)
1113
1114!10 = !{!"rax"}
1115define void @intrinsics.codegen() {
1116  call i8* @llvm.returnaddress(i32 1)
1117  ; CHECK: call i8* @llvm.returnaddress(i32 1)
1118  call i8* @llvm.frameaddress(i32 1)
1119  ; CHECK: call i8* @llvm.frameaddress(i32 1)
1120
1121  call i32 @llvm.read_register.i32(metadata !10)
1122  ; CHECK: call i32 @llvm.read_register.i32(metadata !10)
1123  call i64 @llvm.read_register.i64(metadata !10)
1124  ; CHECK: call i64 @llvm.read_register.i64(metadata !10)
1125  call void @llvm.write_register.i32(metadata !10, i32 0)
1126  ; CHECK: call void @llvm.write_register.i32(metadata !10, i32 0)
1127  call void @llvm.write_register.i64(metadata !10, i64 0)
1128  ; CHECK: call void @llvm.write_register.i64(metadata !10, i64 0)
1129
1130  %stack = call i8* @llvm.stacksave()
1131  ; CHECK: %stack = call i8* @llvm.stacksave()
1132  call void @llvm.stackrestore(i8* %stack)
1133  ; CHECK: call void @llvm.stackrestore(i8* %stack)
1134
1135  call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
1136  ; CHECK: call void @llvm.prefetch(i8* %stack, i32 0, i32 3, i32 0)
1137
1138  call void @llvm.pcmarker(i32 1)
1139  ; CHECK: call void @llvm.pcmarker(i32 1)
1140
1141  call i64 @llvm.readcyclecounter()
1142  ; CHECK: call i64 @llvm.readcyclecounter()
1143
1144  call void @llvm.clear_cache(i8* null, i8* null)
1145  ; CHECK: call void @llvm.clear_cache(i8* null, i8* null)
1146
1147  call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1148  ; CHECK: call void @llvm.instrprof_increment(i8* null, i64 0, i32 0, i32 0)
1149
1150  ret void
1151}
1152
1153; CHECK: attributes #0 = { alignstack=4 }
1154; CHECK: attributes #1 = { alignstack=8 }
1155; CHECK: attributes #2 = { alwaysinline }
1156; CHECK: attributes #3 = { cold }
1157; CHECK: attributes #4 = { inlinehint }
1158; CHECK: attributes #5 = { jumptable }
1159; CHECK: attributes #6 = { minsize }
1160; CHECK: attributes #7 = { naked }
1161; CHECK: attributes #8 = { nobuiltin }
1162; CHECK: attributes #9 = { noduplicate }
1163; CHECK: attributes #10 = { noimplicitfloat }
1164; CHECK: attributes #11 = { noinline }
1165; CHECK: attributes #12 = { nonlazybind }
1166; CHECK: attributes #13 = { noredzone }
1167; CHECK: attributes #14 = { noreturn }
1168; CHECK: attributes #15 = { nounwind }
1169; CHECK: attributes #16 = { noinline optnone }
1170; CHECK: attributes #17 = { optsize }
1171; CHECK: attributes #18 = { readnone }
1172; CHECK: attributes #19 = { readonly }
1173; CHECK: attributes #20 = { returns_twice }
1174; CHECK: attributes #21 = { sanitize_address }
1175; CHECK: attributes #22 = { sanitize_memory }
1176; CHECK: attributes #23 = { sanitize_thread }
1177; CHECK: attributes #24 = { ssp }
1178; CHECK: attributes #25 = { sspreq }
1179; CHECK: attributes #26 = { sspstrong }
1180; CHECK: attributes #27 = { uwtable }
1181; CHECK: attributes #28 = { "cpu"="cortex-a8" }
1182; CHECK: attributes #29 = { nounwind readnone }
1183; CHECK: attributes #30 = { argmemonly nounwind readonly }
1184; CHECK: attributes #31 = { argmemonly nounwind }
1185; CHECK: attributes #32 = { nounwind readonly }
1186; CHECK: attributes #33 = { builtin }
1187
1188;; Metadata
1189
1190; Metadata -- Module flags
1191!llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1192; CHECK: !llvm.module.flags = !{!0, !1, !2, !4, !5, !6}
1193
1194!0 = !{i32 1, !"mod1", i32 0}
1195; CHECK: !0 = !{i32 1, !"mod1", i32 0}
1196!1 = !{i32 2, !"mod2", i32 0}
1197; CHECK: !1 = !{i32 2, !"mod2", i32 0}
1198!2 = !{i32 3, !"mod3", !3}
1199; CHECK: !2 = !{i32 3, !"mod3", !3}
1200!3 = !{!"mod6", !0}
1201; CHECK: !3 = !{!"mod6", !0}
1202!4 = !{i32 4, !"mod4", i32 0}
1203; CHECK: !4 = !{i32 4, !"mod4", i32 0}
1204!5 = !{i32 5, !"mod5", !0}
1205; CHECK: !5 = !{i32 5, !"mod5", !0}
1206!6 = !{i32 6, !"mod6", !0}
1207; CHECK: !6 = !{i32 6, !"mod6", !0}
1208