llvm.org GIT mirror llvm / 194a72b
Remove from release. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_20@37079 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 13 years ago
1 changed file(s) with 0 addition(s) and 795 deletion(s). Raw diff Collapse all Expand all
+0
-795
test/Feature/llvm2cpp.ll less more
None ; RUN: llvm-as < %s | llvm-dis > %t1.ll
1 ; RUN: llvm-as < %s | llvm2cpp -gen-program -o %t2.cpp - -f
2 ; RUN: %link -o %t2.exe %t2.cpp -lLLVMCore -lLLVMSupport -lLLVMSystem -lstdc++
3 ; RUN: %t2.exe > %t2.ll
4 ; RUN: diff %t1.ll %t2.ll
5
6 @X = global i32 4, align 16 ; [#uses=0]
7
8 define i32* @test1012() align 32 {
9 %X = alloca i32, align 4 ; [#uses=1]
10 %Y = alloca i32, i32 42, align 16 ; [#uses=0]
11 %Z = alloca i32 ; [#uses=0]
12 ret i32* %X
13 }
14
15 define i32* @test1013() {
16 %X = malloc i32, align 4 ; [#uses=1]
17 %Y = malloc i32, i32 42, align 16 ; [#uses=0]
18 %Z = malloc i32 ; [#uses=0]
19 ret i32* %X
20 }
21
22 define void @void(i32, i32) {
23 add i32 0, 0 ; :3 [#uses=2]
24 sub i32 0, 4 ; :4 [#uses=2]
25 br label %5
26
27 ;
28 add i32 %0, %1 ; :6 [#uses=2]
29 sub i32 %6, %4 ; :7 [#uses=1]
30 icmp sle i32 %7, %3 ; :8 [#uses=1]
31 br i1 %8, label %9, label %5
32
33 ;
34 add i32 %0, %1 ; :10 [#uses=0]
35 sub i32 %6, %4 ; :11 [#uses=1]
36 icmp sle i32 %11, %3 ; :12 [#uses=0]
37 ret void
38 }
39
40 define i32 @zarro() {
41 Startup:
42 ret i32 0
43 }
44
45 define fastcc void @foo() {
46 ret void
47 }
48
49 define coldcc void @bar() {
50 call fastcc void @foo( )
51 ret void
52 }
53
54 define void @structret({ i8 }* sret %P) {
55 call void @structret( { i8 }* %P sret )
56 ret void
57 }
58
59 define void @foo4() {
60 ret void
61 }
62
63 define coldcc void @bar2() {
64 call fastcc void @foo( )
65 ret void
66 }
67
68 define cc42 void @bar3() {
69 invoke fastcc void @foo( )
70 to label %Ok unwind label %U
71
72 Ok: ; preds = %0
73 ret void
74
75 U: ; preds = %0
76 unwind
77 }
78
79 define void @bar4() {
80 call cc42 void @bar( )
81 invoke cc42 void @bar3( )
82 to label %Ok unwind label %U
83
84 Ok: ; preds = %0
85 ret void
86
87 U: ; preds = %0
88 unwind
89 }
90 ; ModuleID = 'calltest.ll'
91 %FunTy = type i32 (i32)
92
93 define i32 @test1000(i32 %i0) {
94 ret i32 %i0
95 }
96
97 define void @invoke(%FunTy* %x) {
98 %foo = call i32 %x( i32 123 ) ; [#uses=0]
99 %foo2 = tail call i32 %x( i32 123 ) ; [#uses=0]
100 ret void
101 }
102
103 define i32 @main(i32 %argc) {
104 %retval = call i32 @test1000( i32 %argc ) ; [#uses=2]
105 %two = add i32 %retval, %retval ; [#uses=1]
106 %retval2 = invoke i32 @test1000( i32 %argc )
107 to label %Next unwind label %Error ; [#uses=1]
108
109 Next: ; preds = %0
110 %two2 = add i32 %two, %retval2 ; [#uses=1]
111 call void @invoke( %FunTy* @test1000 )
112 ret i32 %two2
113
114 Error: ; preds = %0
115 ret i32 -1
116 }
117 ; ModuleID = 'casttest.ll'
118
119 define i16 @FunFunc(i64 %x, i8 %z) {
120 bb0:
121 %cast110 = sext i8 %z to i16 ; [#uses=1]
122 %cast10 = trunc i64 %x to i16 ; [#uses=1]
123 %reg109 = add i16 %cast110, %cast10 ; [#uses=1]
124 ret i16 %reg109
125 }
126 ; ModuleID = 'cfgstructures.ll'
127
128 define void @irreducible(i1 %cond) {
129 br i1 %cond, label %X, label %Y
130
131 X: ; preds = %Y, %0
132 br label %Y
133
134 Y: ; preds = %X, %0
135 br label %X
136 }
137
138 define void @sharedheader(i1 %cond) {
139 br label %A
140
141 A: ; preds = %Y, %X, %0
142 br i1 %cond, label %X, label %Y
143
144 X: ; preds = %A
145 br label %A
146
147 Y: ; preds = %A
148 br label %A
149 }
150
151 define void @nested(i1 %cond1, i1 %cond2, i1 %cond3) {
152 br label %Loop1
153
154 Loop1: ; preds = %L2Exit, %0
155 br label %Loop2
156
157 Loop2: ; preds = %L3Exit, %Loop1
158 br label %Loop3
159
160 Loop3: ; preds = %Loop3, %Loop2
161 br i1 %cond3, label %Loop3, label %L3Exit
162
163 L3Exit: ; preds = %Loop3
164 br i1 %cond2, label %Loop2, label %L2Exit
165
166 L2Exit: ; preds = %L3Exit
167 br i1 %cond1, label %Loop1, label %L1Exit
168
169 L1Exit: ; preds = %L2Exit
170 ret void
171 }
172 ; ModuleID = 'constexpr.ll'
173 %SAType = type { i32, { [2 x float], i64 } }
174 %SType = type { i32, { float, { i8 } }, i64 }
175 global i64 1 ; :0 [#uses=0]
176 global i64 74514 ; :1 [#uses=0]
177 @t2 = global i32* @t1 ; [#uses=0]
178 @t3 = global i32* @t1 ; [#uses=2]
179 @t1 = global i32 4 ; [#uses=2]
180 @t4 = global i32** @t3 ; [#uses=1]
181 @t5 = global i32** @t3 ; [#uses=0]
182 @t6 = global i32*** @t4 ; [#uses=0]
183 @t7 = global float* inttoptr (i32 12345678 to float*) ; [#uses=0]
184 @t9 = global i32 8 ; [#uses=0]
185 global i32* bitcast (float* @4 to i32*) ; :2 [#uses=0]
186 global float* @4 ; :3 [#uses=0]
187 global float 0.000000e+00 ; :4 [#uses=2]
188 @array = constant [2 x i32] [ i32 12, i32 52 ] ; <[2 x i32]*> [#uses=1]
189 @arrayPtr = global i32* getelementptr ([2 x i32]* @array, i64 0, i64 0) ; [#uses=1]
190 @arrayPtr5 = global i32** getelementptr (i32** @arrayPtr, i64 5) ; [#uses=0]
191 @somestr = constant [11 x i8] c"hello world" ; <[11 x i8]*> [#uses=2]
192 @char5 = global i8* getelementptr ([11 x i8]* @somestr, i64 0, i64 5) ; [#uses=0]
193 @char8a = global i32* bitcast (i8* getelementptr ([11 x i8]* @somestr, i64 0, i64 8) to i32*) ; [#uses=0]
194 @char8b = global i8* getelementptr ([11 x i8]* @somestr, i64 0, i64 8) ; [#uses=0]
195 @S1 = global %SType* null ; <%SType**> [#uses=1]
196 @S2c = constant %SType {
197 i32 1,
198 { float, { i8 } } { float 2.000000e+00, { i8 } { i8 3 } },
199 i64 4 } ; <%SType*> [#uses=3]
200 @S3c = constant %SAType { i32 1, { [2 x float], i64 } { [2 x float] [ float 2.000000e+00, float 3.000000e+00 ], i64 4 } } ; <%SAType*> [#uses=1]
201 @S1ptr = global %SType** @S1 ; <%SType***> [#uses=0]
202 @S2 = global %SType* @S2c ; <%SType**> [#uses=0]
203 @S3 = global %SAType* @S3c ; <%SAType**> [#uses=0]
204 @S1fld1a = global float* getelementptr (%SType* @S2c, i64 0, i32 1, i32 0) ; [#uses=0]
205 @S1fld1b = global float* getelementptr (%SType* @S2c, i64 0, i32 1, i32 0) ; [#uses=1]
206 @S1fld1bptr = global float** @S1fld1b ; [#uses=0]
207 @S2fld3 = global i8* getelementptr (%SType* @S2c, i64 0, i32 1, i32 1, i32 0) ; [#uses=0]
208
209 ; ModuleID = 'constpointer.ll'
210 @cpt3 = global i32* @cpt1 ; [#uses=1]
211 @cpt1 = global i32 4 ; [#uses=2]
212 @cpt4 = global i32** @cpt3 ; [#uses=0]
213 @cpt2 = global i32* @cpt1 ; [#uses=0]
214 global float* @7 ; :0 [#uses=0]
215 global float* @7 ; :1 [#uses=0]
216 global float 0.000000e+00 ; :2 [#uses=3]
217 global float* @7 ; :3 [#uses=0]
218 @fptr = global void ()* @f ; [#uses=0]
219 @sptr1 = global [11 x i8]* @somestr ; <[11 x i8]**> [#uses=0]
220 @somestr2 = constant [11 x i8] c"hello world" ; <[11 x i8]*> [#uses=2]
221 @sptr2 = global [11 x i8]* @somestr2 ; <[11 x i8]**> [#uses=0]
222
223 declare void @f()
224 ; ModuleID = 'escaped_label.ll'
225
226 define i32 @foo3() {
227 br label "foo`~!@#$%^&*()-_=+{}[]\\|;:',<.>/?"
228
229 "foo`~!@#$%^&*()-_=+{}[]\\|;:',<.>/?": ; preds = %0
230 ret i32 17
231 }
232 ; ModuleID = 'float.ll'
233 @F1 = global float 4.000000e+00 ; [#uses=0]
234 @D1 = global double 4.000000e+00 ; [#uses=0]
235 ; ModuleID = 'fold-fpcast.ll'
236
237 define i32 @test1() {
238 ret i32 1080872141
239 }
240
241 define float @test1002() {
242 ret float 0x36E1000000000000
243 }
244
245 define i64 @test3() {
246 ret i64 4614256656431372362
247 }
248
249 define double @test4() {
250 ret double 2.075076e-322
251 }
252 ; ModuleID = 'forwardreftest.ll'
253 %myfn = type float (i32, double, i32, i16)
254 %myty = type i32
255 %thisfuncty = type i32 (i32)*
256
257 declare void @F(%thisfuncty, %thisfuncty, %thisfuncty)
258
259 define i32 @zarro2(i32 %Func) {
260 Startup:
261 add i32 0, 10 ; :0 [#uses=0]
262 ret i32 0
263 }
264
265 define i32 @test1004(i32) {
266 call void @F( %thisfuncty @zarro2, %thisfuncty @test1004, %thisfuncty @foozball )
267 ret i32 0
268 }
269
270 define i32 @foozball(i32) {
271 ret i32 0
272 }
273
274 ; ModuleID = 'globalredefinition.ll'
275 @A = global i32* @B ; [#uses=0]
276 @B = global i32 7 ; [#uses=1]
277
278 define void @X() {
279 ret void
280 }
281 ; ModuleID = 'global_section.ll'
282 @GlobSec = global i32 4, section "foo", align 16
283
284 define void @test1005() section "bar" {
285 ret void
286 }
287
288 ; ModuleID = 'globalvars.ll'
289 @MyVar = external global i32 ; [#uses=1]
290 @MyIntList = external global { \2*, i32 } ; <{ \2*, i32 }*> [#uses=1]
291 external global i32 ; :0 [#uses=0]
292 @AConst = constant i32 123 ; [#uses=0]
293 @AString = constant [4 x i8] c"test" ; <[4 x i8]*> [#uses=0]
294 @ZeroInit = global { [100 x i32], [40 x float] } zeroinitializer ; <{ [100 x i32], [40 x float] }*> [#uses=0]
295
296 define i32 @foo10015(i32 %blah) {
297 store i32 5, i32* @MyVar
298 %idx = getelementptr { \2*, i32 }* @MyIntList, i64 0, i32 1 ; [#uses=1]
299 store i32 12, i32* %idx
300 ret i32 %blah
301 }
302 ; ModuleID = 'indirectcall2.ll'
303
304 define i64 @test1006(i64 %X) {
305 ret i64 %X
306 }
307
308 define i64 @fib(i64 %n) {
309 ;
310 %T = icmp ult i64 %n, 2 ; [#uses=1]
311 br i1 %T, label %BaseCase, label %RecurseCase
312
313 RecurseCase: ; preds = %0
314 %result = call i64 @test1006( i64 %n ) ; [#uses=0]
315 br label %BaseCase
316
317 BaseCase: ; preds = %RecurseCase, %0
318 %X = phi i64 [ 1, %0 ], [ 2, %RecurseCase ] ; [#uses=1]
319 ret i64 %X
320 }
321 ; ModuleID = 'indirectcall.ll'
322
323 declare i32 @atoi(i8*)
324
325 define i64 @fibonacc(i64 %n) {
326 icmp ult i64 %n, 2 ; :1 [#uses=1]
327 br i1 %1, label %BaseCase, label %RecurseCase
328
329 BaseCase: ; preds = %0
330 ret i64 1
331
332 RecurseCase: ; preds = %0
333 %n2 = sub i64 %n, 2 ; [#uses=1]
334 %n1 = sub i64 %n, 1 ; [#uses=1]
335 %f2 = call i64 @fibonacc( i64 %n2 ) ; [#uses=1]
336 %f1 = call i64 @fibonacc( i64 %n1 ) ; [#uses=1]
337 %result = add i64 %f2, %f1 ; [#uses=1]
338 ret i64 %result
339 }
340
341 define i64 @realmain(i32 %argc, i8** %argv) {
342 ;
343 icmp eq i32 %argc, 2 ; :1 [#uses=1]
344 br i1 %1, label %HasArg, label %Continue
345
346 HasArg: ; preds = %0
347 %n1 = add i32 1, 1 ; [#uses=1]
348 br label %Continue
349
350 Continue: ; preds = %HasArg, %0
351 %n = phi i32 [ %n1, %HasArg ], [ 1, %0 ] ; [#uses=1]
352 %N = sext i32 %n to i64 ; [#uses=1]
353 %F = call i64 @fib( i64 %N ) ; [#uses=1]
354 ret i64 %F
355 }
356
357 define i64 @trampoline(i64 %n, i64 (i64)* %fibfunc) {
358 %F = call i64 %fibfunc( i64 %n ) ; [#uses=1]
359 ret i64 %F
360 }
361
362 define i32 @main2() {
363 %Result = call i64 @trampoline( i64 10, i64 (i64)* @fib ) ; [#uses=1]
364 %Result.upgrd.1 = trunc i64 %Result to i32 ; [#uses=1]
365 ret i32 %Result.upgrd.1
366 }
367 ; ModuleID = 'inlineasm.ll'
368 module asm "this is an inline asm block"
369 module asm "this is another inline asm block"
370
371 define i32 @test1007() {
372 %X = call i32 asm "tricky here $0, $1", "=r,r"( i32 4 ) ; [#uses=1]
373 call void asm sideeffect "eieio", ""( )
374 ret i32 %X
375 }
376 ; ModuleID = 'instructions.ll'
377
378 define i32 @test_extractelement(<4 x i32> %V) {
379 %R = extractelement <4 x i32> %V, i32 1 ; [#uses=1]
380 ret i32 %R
381 }
382
383 define <4 x i32> @test_insertelement(<4 x i32> %V) {
384 %R = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1]
385 ret <4 x i32> %R
386 }
387
388 define <4 x i32> @test_shufflevector_u(<4 x i32> %V) {
389 %R = shufflevector <4 x i32> %V, <4 x i32> %V, <4 x i32> < i32 1, i32 undef, i32 7, i32 2 > ; <<4 x i32>> [#uses=1]
390 ret <4 x i32> %R
391 }
392
393 define <4 x float> @test_shufflevector_f(<4 x float> %V) {
394 %R = shufflevector <4 x float> %V, <4 x float> undef, <4 x i32> < i32 1, i32 undef, i32 7, i32 2 > ; <<4 x float>> [#uses=1]
395 ret <4 x float> %R
396 }
397 ; ModuleID = 'intrinsics.ll'
398
399 declare i1 @llvm.isunordered.f32(float, float)
400
401 declare i1 @llvm.isunordered.f64(double, double)
402
403 declare void @llvm.prefetch(i8*, i32, i32)
404
405 declare i32 @upgrd.rm.llvm.ctpop.i8(i8)
406
407 declare i32 @upgrd.rm.llvm.ctpop.i16(i16)
408
409 declare i32 @upgrd.rm.llvm.ctpop.i32(i32)
410
411 declare i32 @upgrd.rm.llvm.ctpop.i64(i64)
412
413 declare i32 @upgrd.rm.llvm.cttz.i8(i8)
414
415 declare i32 @upgrd.rm.llvm.cttz.i16(i16)
416
417 declare i32 @upgrd.rm.llvm.cttz.i32(i32)
418
419 declare i32 @upgrd.rm.llvm.cttz.i64(i64)
420
421 declare i32 @upgrd.rm.llvm.ctlz.i8(i8)
422
423 declare i32 @upgrd.rm.llvm.ctlz.i16(i16)
424
425 declare i32 @upgrd.rm.llvm.ctlz.i32(i32)
426
427 declare i32 @upgrd.rm.llvm.ctlz.i64(i64)
428
429 declare float @llvm.sqrt.f32(float)
430
431 declare double @llvm.sqrt.f64(double)
432
433 define void @libm() {
434 fcmp uno float 1.000000e+00, 2.000000e+00 ; :1 [#uses=0]
435 fcmp uno double 3.000000e+00, 4.000000e+00 ; :2 [#uses=0]
436 call void @llvm.prefetch( i8* null, i32 1, i32 3 )
437 call float @llvm.sqrt.f32( float 5.000000e+00 ) ; :3 [#uses=0]
438 call double @llvm.sqrt.f64( double 6.000000e+00 ) ; :4 [#uses=0]
439 call i32 @llvm.ctpop.i8( i8 10 ) ; :5 [#uses=1]
440 bitcast i32 %5 to i32 ; :6 [#uses=0]
441 call i32 @llvm.ctpop.i16( i16 11 ) ; :7 [#uses=1]
442 bitcast i32 %7 to i32 ; :8 [#uses=0]
443 call i32 @llvm.ctpop.i32( i32 12 ) ; :9 [#uses=1]
444 bitcast i32 %9 to i32 ; :10 [#uses=0]
445 call i32 @llvm.ctpop.i64( i64 13 ) ; :11 [#uses=1]
446 bitcast i32 %11 to i32 ; :12 [#uses=0]
447 call i32 @llvm.ctlz.i8( i8 14 ) ; :13 [#uses=1]
448 bitcast i32 %13 to i32 ; :14 [#uses=0]
449 call i32 @llvm.ctlz.i16( i16 15 ) ; :15 [#uses=1]
450 bitcast i32 %15 to i32 ; :16 [#uses=0]
451 call i32 @llvm.ctlz.i32( i32 16 ) ; :17 [#uses=1]
452 bitcast i32 %17 to i32 ; :18 [#uses=0]
453 call i32 @llvm.ctlz.i64( i64 17 ) ; :19 [#uses=1]
454 bitcast i32 %19 to i32 ; :20 [#uses=0]
455 call i32 @llvm.cttz.i8( i8 18 ) ; :21 [#uses=1]
456 bitcast i32 %21 to i32 ; :22 [#uses=0]
457 call i32 @llvm.cttz.i16( i16 19 ) ; :23 [#uses=1]
458 bitcast i32 %23 to i32 ; :24 [#uses=0]
459 call i32 @llvm.cttz.i32( i32 20 ) ; :25 [#uses=1]
460 bitcast i32 %25 to i32 ; :26 [#uses=0]
461 call i32 @llvm.cttz.i64( i64 21 ) ; :27 [#uses=1]
462 bitcast i32 %27 to i32 ; :28 [#uses=0]
463 ret void
464 }
465
466 declare i32 @llvm.ctpop.i8(i8)
467
468 declare i32 @llvm.ctpop.i16(i16)
469
470 declare i32 @llvm.ctpop.i32(i32)
471
472 declare i32 @llvm.ctpop.i64(i64)
473
474 declare i32 @llvm.ctlz.i8(i8)
475
476 declare i32 @llvm.ctlz.i16(i16)
477
478 declare i32 @llvm.ctlz.i32(i32)
479
480 declare i32 @llvm.ctlz.i64(i64)
481
482 declare i32 @llvm.cttz.i8(i8)
483
484 declare i32 @llvm.cttz.i16(i16)
485
486 declare i32 @llvm.cttz.i32(i32)
487
488 declare i32 @llvm.cttz.i64(i64)
489
490 ; ModuleID = 'packed.ll'
491 @foo1 = external global <4 x float> ; <<4 x float>*> [#uses=2]
492 @foo102 = external global <2 x i32> ; <<2 x i32>*> [#uses=2]
493
494 define void @main3() {
495 store <4 x float> < float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 >, <4 x float>* @foo1
496 store <2 x i32> < i32 4, i32 4 >, <2 x i32>* @foo102
497 %l1 = load <4 x float>* @foo1 ; <<4 x float>> [#uses=0]
498 %l2 = load <2 x i32>* @foo102 ; <<2 x i32>> [#uses=0]
499 ret void
500 }
501
502 ; ModuleID = 'properties.ll'
503 target datalayout = "e-p:32:32"
504 target triple = "proc-vend-sys"
505 deplibs = [ "m", "c" ]
506 ; ModuleID = 'prototype.ll'
507
508 declare i32 @bar1017(i32 %in)
509
510 define i32 @foo1016(i32 %blah) {
511 %xx = call i32 @bar1017( i32 %blah ) ; [#uses=1]
512 ret i32 %xx
513 }
514
515 ; ModuleID = 'recursivetype.ll'
516 %list = type { %list*, i32 }
517
518 declare i8* @malloc(i32)
519
520 define void @InsertIntoListTail(%list** %L, i32 %Data) {
521 bb1:
522 %reg116 = load %list** %L ; <%list*> [#uses=1]
523 %cast1004 = inttoptr i64 0 to %list* ; <%list*> [#uses=1]
524 %cond1000 = icmp eq %list* %reg116, %cast1004 ; [#uses=1]
525 br i1 %cond1000, label %bb3, label %bb2
526
527 bb2: ; preds = %bb2, %bb1
528 %reg117 = phi %list** [ %reg118, %bb2 ], [ %L, %bb1 ] ; <%list**> [#uses=1]
529 %cast1010 = bitcast %list** %reg117 to %list*** ; <%list***> [#uses=1]
530 %reg118 = load %list*** %cast1010 ; <%list**> [#uses=3]
531 %reg109 = load %list** %reg118 ; <%list*> [#uses=1]
532 %cast1005 = inttoptr i64 0 to %list* ; <%list*> [#uses=1]
533 %cond1001 = icmp ne %list* %reg109, %cast1005 ; [#uses=1]
534 br i1 %cond1001, label %bb2, label %bb3
535
536 bb3: ; preds = %bb2, %bb1
537 %reg119 = phi %list** [ %reg118, %bb2 ], [ %L, %bb1 ] ; <%list**> [#uses=1]
538 %cast1006 = bitcast %list** %reg119 to i8** ; [#uses=1]
539 %reg111 = call i8* @malloc( i32 16 ) ; [#uses=3]
540 store i8* %reg111, i8** %cast1006
541 %reg111.upgrd.1 = ptrtoint i8* %reg111 to i64 ; [#uses=1]
542 %reg1002 = add i64 %reg111.upgrd.1, 8 ; [#uses=1]
543 %reg1002.upgrd.2 = inttoptr i64 %reg1002 to i8* ; [#uses=1]
544 %cast1008 = bitcast i8* %reg1002.upgrd.2 to i32* ; [#uses=1]
545 store i32 %Data, i32* %cast1008
546 %cast1003 = inttoptr i64 0 to i64* ; [#uses=1]
547 %cast1009 = bitcast i8* %reg111 to i64** ; [#uses=1]
548 store i64* %cast1003, i64** %cast1009
549 ret void
550 }
551
552 define %list* @FindData(%list* %L, i32 %Data) {
553 bb1:
554 br label %bb2
555
556 bb2: ; preds = %bb6, %bb1
557 %reg115 = phi %list* [ %reg116, %bb6 ], [ %L, %bb1 ] ; <%list*> [#uses=4]
558 %cast1014 = inttoptr i64 0 to %list* ; <%list*> [#uses=1]
559 %cond1011 = icmp ne %list* %reg115, %cast1014 ; [#uses=1]
560 br i1 %cond1011, label %bb4, label %bb3
561
562 bb3: ; preds = %bb2
563 ret %list* null
564
565 bb4: ; preds = %bb2
566 %idx = getelementptr %list* %reg115, i64 0, i32 1 ; [#uses=1]
567 %reg111 = load i32* %idx ; [#uses=1]
568 %cond1013 = icmp ne i32 %reg111, %Data ; [#uses=1]
569 br i1 %cond1013, label %bb6, label %bb5
570
571 bb5: ; preds = %bb4
572 ret %list* %reg115
573
574 bb6: ; preds = %bb4
575 %idx2 = getelementptr %list* %reg115, i64 0, i32 0 ; <%list**> [#uses=1]
576 %reg116 = load %list** %idx2 ; <%list*> [#uses=1]
577 br label %bb2
578 }
579 ; ModuleID = 'simplecalltest.ll'
580 %FunTy = type i32 (i32)
581
582 define void @invoke1019(%FunTy* %x) {
583 %foo = call i32 %x( i32 123 ) ; [#uses=0]
584 ret void
585 }
586
587 define i32 @main4(i32 %argc, i8** %argv, i8** %envp) {
588 %retval = call i32 @test1008( i32 %argc ) ; [#uses=2]
589 %two = add i32 %retval, %retval ; [#uses=1]
590 %retval2 = call i32 @test1008( i32 %argc ) ; [#uses=1]
591 %two2 = add i32 %two, %retval2 ; [#uses=1]
592 call void @invoke1019( %FunTy* @test1008 )
593 ret i32 %two2
594 }
595
596 define i32 @test1008(i32 %i0) {
597 ret i32 %i0
598 }
599 ; ModuleID = 'smallest.ll'
600 ; ModuleID = 'small.ll'
601 %x = type i32
602
603 define i32 @foo1020(i32 %in) {
604 label:
605 ret i32 2
606 }
607 ; ModuleID = 'testalloca.ll'
608 %inners = type { float, { i8 } }
609 %struct = type { i32, %inners, i64 }
610
611 define i32 @testfunction(i32 %i0, i32 %j0) {
612 alloca i8, i32 5 ; :1 [#uses=0]
613 %ptr = alloca i32 ; [#uses=2]
614 store i32 3, i32* %ptr
615 %val = load i32* %ptr ; [#uses=0]
616 %sptr = alloca %struct ; <%struct*> [#uses=2]
617 %nsptr = getelementptr %struct* %sptr, i64 0, i32 1 ; <%inners*> [#uses=1]
618 %ubsptr = getelementptr %inners* %nsptr, i64 0, i32 1 ; <{ i8 }*> [#uses=1]
619 %idx = getelementptr { i8 }* %ubsptr, i64 0, i32 0 ; [#uses=1]
620 store i8 4, i8* %idx
621 %fptr = getelementptr %struct* %sptr, i64 0, i32 1, i32 0 ; [#uses=1]
622 store float 4.000000e+00, float* %fptr
623 ret i32 3
624 }
625 ; ModuleID = 'testconstants.ll'
626 @somestr3 = constant [11 x i8] c"hello world"
627 @array99 = constant [2 x i32] [ i32 12, i32 52 ]
628 constant { i32, i32 } { i32 4, i32 3 } ; <{ i32, i32 }*>:0 [#uses=0]
629
630 define [2 x i32]* @testfunction99(i32 %i0, i32 %j0) {
631 ret [2 x i32]* @array
632 }
633
634 define i8* @otherfunc(i32, double) {
635 %somestr = getelementptr [11 x i8]* @somestr3, i64 0, i64 0 ; [#uses=1]
636 ret i8* %somestr
637 }
638
639 define i8* @yetanotherfunc(i32, double) {
640 ret i8* null
641 }
642
643 define i32 @negativeUnsigned() {
644 ret i32 -1
645 }
646
647 define i32 @largeSigned() {
648 ret i32 -394967296
649 }
650 ; ModuleID = 'testlogical.ll'
651
652 define i32 @simpleAdd(i32 %i0, i32 %j0) {
653 %t1 = xor i32 %i0, %j0 ; [#uses=1]
654 %t2 = or i32 %i0, %j0 ; [#uses=1]
655 %t3 = and i32 %t1, %t2 ; [#uses=1]
656 ret i32 %t3
657 }
658 ; ModuleID = 'testmemory.ll'
659 %complexty = type { i32, { [4 x i8*], float }, double }
660 %struct = type { i32, { float, { i8 } }, i64 }
661
662 define i32 @main6() {
663 call i32 @testfunction98( i64 0, i64 1 )
664 ret i32 0
665 }
666
667 define i32 @testfunction98(i64 %i0, i64 %j0) {
668 %array0 = malloc [4 x i8] ; <[4 x i8]*> [#uses=2]
669 %size = add i32 2, 2 ; [#uses=1]
670 %array1 = malloc i8, i32 4 ; [#uses=1]
671 %array2 = malloc i8, i32 %size ; [#uses=1]
672 %idx = getelementptr [4 x i8]* %array0, i64 0, i64 2 ; [#uses=1]
673 store i8 123, i8* %idx
674 free [4 x i8]* %array0
675 free i8* %array1
676 free i8* %array2
677 %aa = alloca %complexty, i32 5 ; <%complexty*> [#uses=1]
678 %idx2 = getelementptr %complexty* %aa, i64 %i0, i32 1, i32 0, i64 %j0 ; [#uses=1]
679 store i8* null, i8** %idx2
680 %ptr = alloca i32 ; [#uses=2]
681 store i32 3, i32* %ptr
682 %val = load i32* %ptr ; [#uses=0]
683 %sptr = alloca %struct ; <%struct*> [#uses=1]
684 %ubsptr = getelementptr %struct* %sptr, i64 0, i32 1, i32 1 ; <{ i8 }*> [#uses=1]
685 %idx3 = getelementptr { i8 }* %ubsptr, i64 0, i32 0 ; [#uses=1]
686 store i8 4, i8* %idx3
687 ret i32 3
688 }
689 ; ModuleID = 'testswitch.ll'
690 %int = type i32
691
692 define i32 @squared(i32 %i0) {
693 switch i32 %i0, label %Default [
694 i32 1, label %Case1
695 i32 2, label %Case2
696 i32 4, label %Case4
697 ]
698
699 Default: ; preds = %0
700 ret i32 -1
701
702 Case1: ; preds = %0
703 ret i32 1
704
705 Case2: ; preds = %0
706 ret i32 4
707
708 Case4: ; preds = %0
709 ret i32 16
710 }
711 ; ModuleID = 'testvarargs.ll'
712
713 declare i32 @printf(i8*, ...)
714
715 define i32 @testvarar() {
716 call i32 (i8*, ...)* @printf( i8* null, i32 12, i8 42 ) ; :1 [#uses=1]
717 ret i32 %1
718 }
719 ; ModuleID = 'undefined.ll'
720 @X2 = global i32 undef ; [#uses=0]
721
722 declare i32 @atoi(i8*)
723
724 define i32 @test1009() {
725 ret i32 undef
726 }
727
728 define i32 @test1003() {
729 %X = add i32 undef, 1 ; [#uses=1]
730 ret i32 %X
731 }
732 ; ModuleID = 'unreachable.ll'
733
734 declare void @bar()
735
736 define i32 @foo1021() {
737 unreachable
738 }
739
740 define double @xyz() {
741 call void @bar( )
742 unreachable
743 }
744 ; ModuleID = 'varargs.ll'
745
746 declare void @llvm.va_start(i8* %ap)
747
748 declare void @llvm.va_copy(i8* %aq, i8* %ap)
749
750 declare void @llvm.va_end(i8* %ap)
751
752 define i32 @test1010(i32 %X, ...) {
753 %ap = alloca i8* ; [#uses=4]
754 %va.upgrd.1 = bitcast i8** %ap to i8* ; [#uses=1]
755 call void @llvm.va_start( i8* %va.upgrd.1 )
756 %tmp = va_arg i8** %ap, i32 ; [#uses=1]
757 %aq = alloca i8* ; [#uses=2]
758 %va0.upgrd.2 = bitcast i8** %aq to i8* ; [#uses=1]
759 %va1.upgrd.3 = bitcast i8** %ap to i8* ; [#uses=1]
760 call void @llvm.va_copy( i8* %va0.upgrd.2, i8* %va1.upgrd.3 )
761 %va.upgrd.4 = bitcast i8** %aq to i8* ; [#uses=1]
762 call void @llvm.va_end( i8* %va.upgrd.4 )
763 %va.upgrd.5 = bitcast i8** %ap to i8* ; [#uses=1]
764 call void @llvm.va_end( i8* %va.upgrd.5 )
765 ret i32 %tmp
766 }
767 ; ModuleID = 'varargs_new.ll'
768
769 declare void @llvm.va_start(i8*)
770
771 declare void @llvm.va_copy(i8*, i8*)
772
773 declare void @llvm.va_end(i8*)
774
775 define i32 @test1011(i32 %X, ...) {
776 %ap = alloca i8* ; [#uses=4]
777 %aq = alloca i8* ; [#uses=2]
778 %va.upgrd.1 = bitcast i8** %ap to i8* ; [#uses=1]
779 call void @llvm.va_start( i8* %va.upgrd.1 )
780 %tmp = va_arg i8** %ap, i32 ; [#uses=1]
781 %apv = load i8** %ap ; [#uses=1]
782 %va0.upgrd.2 = bitcast i8** %aq to i8* ; [#uses=1]
783 %va1.upgrd.3 = bitcast i8* %apv to i8* ; [#uses=1]
784 call void @llvm.va_copy( i8* %va0.upgrd.2, i8* %va1.upgrd.3 )
785 %va.upgrd.4 = bitcast i8** %aq to i8* ; [#uses=1]
786 call void @llvm.va_end( i8* %va.upgrd.4 )
787 %va.upgrd.5 = bitcast i8** %ap to i8* ; [#uses=1]
788 call void @llvm.va_end( i8* %va.upgrd.5 )
789 ret i32 %tmp
790 }
791 ; ModuleID = 'weirdnames.ll'
792 "&^ " = type { i32 }
793 @"%.*+ foo" = global "&^ " { i32 5 } ; <"&^ "*> [#uses=0]
794 @"0" = global float 0.000000e+00 ; [#uses=0]