1 ; RUN: llvm-as < %s | llvm-dis > %t1.ll
2 ; RUN: llvm-as < %s | llvm2cpp -gen-program -o %t2.cpp - -f
3 ; RUN: %link -o %t2.exe %t2.cpp -lLLVMCore -lLLVMSupport -lLLVMSystem -lstdc++
4 ; RUN: %t2.exe > %t2.ll
5 ; RUN: diff %t1.ll %t2.ll
7 @X = global i32 4, align 16 ; <i32*> [#uses=0]
9 define i32* @test1012() align 32 {
10 %X = alloca i32, align 4 ; <i32*> [#uses=1]
11 %Y = alloca i32, i32 42, align 16 ; <i32*> [#uses=0]
12 %Z = alloca i32 ; <i32*> [#uses=0]
16 define i32* @test1013() {
17 %X = malloc i32, align 4 ; <i32*> [#uses=1]
18 %Y = malloc i32, i32 42, align 16 ; <i32*> [#uses=0]
19 %Z = malloc i32 ; <i32*> [#uses=0]
23 define void @void(i32, i32) {
24 add i32 0, 0 ; <i32>:3 [#uses=2]
25 sub i32 0, 4 ; <i32>:4 [#uses=2]
28 ; <label>:5 ; preds = %5, %2
29 add i32 %0, %1 ; <i32>:6 [#uses=2]
30 sub i32 %6, %4 ; <i32>:7 [#uses=1]
31 icmp sle i32 %7, %3 ; <i1>:8 [#uses=1]
32 br i1 %8, label %9, label %5
34 ; <label>:9 ; preds = %5
35 add i32 %0, %1 ; <i32>:10 [#uses=0]
36 sub i32 %6, %4 ; <i32>:11 [#uses=1]
37 icmp sle i32 %11, %3 ; <i1>:12 [#uses=0]
46 define fastcc void @foo() {
50 define coldcc void @bar() {
51 call fastcc void @foo( )
55 define void @structret({ i8 }* sret %P) {
56 call void @structret( { i8 }* %P sret )
64 define coldcc void @bar2() {
65 call fastcc void @foo( )
69 define cc42 void @bar3() {
70 invoke fastcc void @foo( )
71 to label %Ok unwind label %U
81 call cc42 void @bar( )
82 invoke cc42 void @bar3( )
83 to label %Ok unwind label %U
91 ; ModuleID = 'calltest.ll'
92 %FunTy = type i32 (i32)
94 define i32 @test1000(i32 %i0) {
98 define void @invoke(%FunTy* %x) {
99 %foo = call i32 %x( i32 123 ) ; <i32> [#uses=0]
100 %foo2 = tail call i32 %x( i32 123 ) ; <i32> [#uses=0]
104 define i32 @main(i32 %argc) {
105 %retval = call i32 @test1000( i32 %argc ) ; <i32> [#uses=2]
106 %two = add i32 %retval, %retval ; <i32> [#uses=1]
107 %retval2 = invoke i32 @test1000( i32 %argc )
108 to label %Next unwind label %Error ; <i32> [#uses=1]
111 %two2 = add i32 %two, %retval2 ; <i32> [#uses=1]
112 call void @invoke( %FunTy* @test1000 )
118 ; ModuleID = 'casttest.ll'
120 define i16 @FunFunc(i64 %x, i8 %z) {
122 %cast110 = sext i8 %z to i16 ; <i16> [#uses=1]
123 %cast10 = trunc i64 %x to i16 ; <i16> [#uses=1]
124 %reg109 = add i16 %cast110, %cast10 ; <i16> [#uses=1]
127 ; ModuleID = 'cfgstructures.ll'
129 define void @irreducible(i1 %cond) {
130 br i1 %cond, label %X, label %Y
139 define void @sharedheader(i1 %cond) {
142 A: ; preds = %Y, %X, %0
143 br i1 %cond, label %X, label %Y
152 define void @nested(i1 %cond1, i1 %cond2, i1 %cond3) {
155 Loop1: ; preds = %L2Exit, %0
158 Loop2: ; preds = %L3Exit, %Loop1
161 Loop3: ; preds = %Loop3, %Loop2
162 br i1 %cond3, label %Loop3, label %L3Exit
164 L3Exit: ; preds = %Loop3
165 br i1 %cond2, label %Loop2, label %L2Exit
167 L2Exit: ; preds = %L3Exit
168 br i1 %cond1, label %Loop1, label %L1Exit
170 L1Exit: ; preds = %L2Exit
173 ; ModuleID = 'constexpr.ll'
174 %SAType = type { i32, { [2 x float], i64 } }
175 %SType = type { i32, { float, { i8 } }, i64 }
176 global i64 1 ; <i64*>:0 [#uses=0]
177 global i64 74514 ; <i64*>:1 [#uses=0]
178 @t2 = global i32* @t1 ; <i32**> [#uses=0]
179 @t3 = global i32* @t1 ; <i32**> [#uses=2]
180 @t1 = global i32 4 ; <i32*> [#uses=2]
181 @t4 = global i32** @t3 ; <i32***> [#uses=1]
182 @t5 = global i32** @t3 ; <i32***> [#uses=0]
183 @t6 = global i32*** @t4 ; <i32****> [#uses=0]
184 @t7 = global float* inttoptr (i32 12345678 to float*) ; <float**> [#uses=0]
185 @t9 = global i32 8 ; <i32*> [#uses=0]
186 global i32* bitcast (float* @4 to i32*) ; <i32**>:2 [#uses=0]
187 global float* @4 ; <float**>:3 [#uses=0]
188 global float 0.000000e+00 ; <float*>:4 [#uses=2]
189 @array = constant [2 x i32] [ i32 12, i32 52 ] ; <[2 x i32]*> [#uses=1]
190 @arrayPtr = global i32* getelementptr ([2 x i32]* @array, i64 0, i64 0) ; <i32**> [#uses=1]
191 @arrayPtr5 = global i32** getelementptr (i32** @arrayPtr, i64 5) ; <i32***> [#uses=0]
192 @somestr = constant [11 x i8] c"hello world" ; <[11 x i8]*> [#uses=2]
193 @char5 = global i8* getelementptr ([11 x i8]* @somestr, i64 0, i64 5) ; <i8**> [#uses=0]
194 @char8a = global i32* bitcast (i8* getelementptr ([11 x i8]* @somestr, i64 0, i64 8) to i32*) ; <i32**> [#uses=0]
195 @char8b = global i8* getelementptr ([11 x i8]* @somestr, i64 0, i64 8) ; <i8**> [#uses=0]
196 @S1 = global %SType* null ; <%SType**> [#uses=1]
197 @S2c = constant %SType {
199 { float, { i8 } } { float 2.000000e+00, { i8 } { i8 3 } },
200 i64 4 } ; <%SType*> [#uses=3]
201 @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]
202 @S1ptr = global %SType** @S1 ; <%SType***> [#uses=0]
203 @S2 = global %SType* @S2c ; <%SType**> [#uses=0]
204 @S3 = global %SAType* @S3c ; <%SAType**> [#uses=0]
205 @S1fld1a = global float* getelementptr (%SType* @S2c, i64 0, i32 1, i32 0) ; <float**> [#uses=0]
206 @S1fld1b = global float* getelementptr (%SType* @S2c, i64 0, i32 1, i32 0) ; <float**> [#uses=1]
207 @S1fld1bptr = global float** @S1fld1b ; <float***> [#uses=0]
208 @S2fld3 = global i8* getelementptr (%SType* @S2c, i64 0, i32 1, i32 1, i32 0) ; <i8**> [#uses=0]
210 ; ModuleID = 'constpointer.ll'
211 @cpt3 = global i32* @cpt1 ; <i32**> [#uses=1]
212 @cpt1 = global i32 4 ; <i32*> [#uses=2]
213 @cpt4 = global i32** @cpt3 ; <i32***> [#uses=0]
214 @cpt2 = global i32* @cpt1 ; <i32**> [#uses=0]
215 global float* @7 ; <float**>:0 [#uses=0]
216 global float* @7 ; <float**>:1 [#uses=0]
217 global float 0.000000e+00 ; <float*>:2 [#uses=3]
218 global float* @7 ; <float**>:3 [#uses=0]
219 @fptr = global void ()* @f ; <void ()**> [#uses=0]
220 @sptr1 = global [11 x i8]* @somestr ; <[11 x i8]**> [#uses=0]
221 @somestr2 = constant [11 x i8] c"hello world" ; <[11 x i8]*> [#uses=2]
222 @sptr2 = global [11 x i8]* @somestr2 ; <[11 x i8]**> [#uses=0]
225 ; ModuleID = 'escaped_label.ll'
228 br label "foo`~!@#$%^&*()-_=+{}[]\\|;:',<.>/?"
230 "foo`~!@#$%^&*()-_=+{}[]\\|;:',<.>/?": ; preds = %0
233 ; ModuleID = 'float.ll'
234 @F1 = global float 4.000000e+00 ; <float*> [#uses=0]
235 @D1 = global double 4.000000e+00 ; <double*> [#uses=0]
236 ; ModuleID = 'fold-fpcast.ll'
238 define i32 @test1() {
242 define float @test1002() {
243 ret float 0x36E1000000000000
246 define i64 @test3() {
247 ret i64 4614256656431372362
250 define double @test4() {
251 ret double 2.075076e-322
253 ; ModuleID = 'forwardreftest.ll'
254 %myfn = type float (i32, double, i32, i16)
256 %thisfuncty = type i32 (i32)*
258 declare void @F(%thisfuncty, %thisfuncty, %thisfuncty)
260 define i32 @zarro2(i32 %Func) {
262 add i32 0, 10 ; <i32>:0 [#uses=0]
266 define i32 @test1004(i32) {
267 call void @F( %thisfuncty @zarro2, %thisfuncty @test1004, %thisfuncty @foozball )
271 define i32 @foozball(i32) {
275 ; ModuleID = 'globalredefinition.ll'
276 @A = global i32* @B ; <i32**> [#uses=0]
277 @B = global i32 7 ; <i32*> [#uses=1]
282 ; ModuleID = 'global_section.ll'
283 @GlobSec = global i32 4, section "foo", align 16
285 define void @test1005() section "bar" {
289 ; ModuleID = 'globalvars.ll'
290 @MyVar = external global i32 ; <i32*> [#uses=1]
291 @MyIntList = external global { \2*, i32 } ; <{ \2*, i32 }*> [#uses=1]
292 external global i32 ; <i32*>:0 [#uses=0]
293 @AConst = constant i32 123 ; <i32*> [#uses=0]
294 @AString = constant [4 x i8] c"test" ; <[4 x i8]*> [#uses=0]
295 @ZeroInit = global { [100 x i32], [40 x float] } zeroinitializer ; <{ [100 x i32], [40 x float] }*> [#uses=0]
297 define i32 @foo10015(i32 %blah) {
298 store i32 5, i32* @MyVar
299 %idx = getelementptr { \2*, i32 }* @MyIntList, i64 0, i32 1 ; <i32*> [#uses=1]
300 store i32 12, i32* %idx
303 ; ModuleID = 'indirectcall2.ll'
305 define i64 @test1006(i64 %X) {
309 define i64 @fib(i64 %n) {
311 %T = icmp ult i64 %n, 2 ; <i1> [#uses=1]
312 br i1 %T, label %BaseCase, label %RecurseCase
314 RecurseCase: ; preds = %0
315 %result = call i64 @test1006( i64 %n ) ; <i64> [#uses=0]
318 BaseCase: ; preds = %RecurseCase, %0
319 %X = phi i64 [ 1, %0 ], [ 2, %RecurseCase ] ; <i64> [#uses=1]
322 ; ModuleID = 'indirectcall.ll'
324 declare i32 @atoi(i8*)
326 define i64 @fibonacc(i64 %n) {
327 icmp ult i64 %n, 2 ; <i1>:1 [#uses=1]
328 br i1 %1, label %BaseCase, label %RecurseCase
330 BaseCase: ; preds = %0
333 RecurseCase: ; preds = %0
334 %n2 = sub i64 %n, 2 ; <i64> [#uses=1]
335 %n1 = sub i64 %n, 1 ; <i64> [#uses=1]
336 %f2 = call i64 @fibonacc( i64 %n2 ) ; <i64> [#uses=1]
337 %f1 = call i64 @fibonacc( i64 %n1 ) ; <i64> [#uses=1]
338 %result = add i64 %f2, %f1 ; <i64> [#uses=1]
342 define i64 @realmain(i32 %argc, i8** %argv) {
344 icmp eq i32 %argc, 2 ; <i1>:1 [#uses=1]
345 br i1 %1, label %HasArg, label %Continue
348 %n1 = add i32 1, 1 ; <i32> [#uses=1]
351 Continue: ; preds = %HasArg, %0
352 %n = phi i32 [ %n1, %HasArg ], [ 1, %0 ] ; <i32> [#uses=1]
353 %N = sext i32 %n to i64 ; <i64> [#uses=1]
354 %F = call i64 @fib( i64 %N ) ; <i64> [#uses=1]
358 define i64 @trampoline(i64 %n, i64 (i64)* %fibfunc) {
359 %F = call i64 %fibfunc( i64 %n ) ; <i64> [#uses=1]
363 define i32 @main2() {
364 %Result = call i64 @trampoline( i64 10, i64 (i64)* @fib ) ; <i64> [#uses=1]
365 %Result.upgrd.1 = trunc i64 %Result to i32 ; <i32> [#uses=1]
366 ret i32 %Result.upgrd.1
368 ; ModuleID = 'inlineasm.ll'
369 module asm "this is an inline asm block"
370 module asm "this is another inline asm block"
372 define i32 @test1007() {
373 %X = call i32 asm "tricky here $0, $1", "=r,r"( i32 4 ) ; <i32> [#uses=1]
374 call void asm sideeffect "eieio", ""( )
377 ; ModuleID = 'instructions.ll'
379 define i32 @test_extractelement(<4 x i32> %V) {
380 %R = extractelement <4 x i32> %V, i32 1 ; <i32> [#uses=1]
384 define <4 x i32> @test_insertelement(<4 x i32> %V) {
385 %R = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1]
389 define <4 x i32> @test_shufflevector_u(<4 x i32> %V) {
390 %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]
394 define <4 x float> @test_shufflevector_f(<4 x float> %V) {
395 %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]
398 ; ModuleID = 'intrinsics.ll'
400 declare i1 @llvm.isunordered.f32(float, float)
402 declare i1 @llvm.isunordered.f64(double, double)
404 declare void @llvm.prefetch(i8*, i32, i32)
406 declare i32 @upgrd.rm.llvm.ctpop.i8(i8)
408 declare i32 @upgrd.rm.llvm.ctpop.i16(i16)
410 declare i32 @upgrd.rm.llvm.ctpop.i32(i32)
412 declare i32 @upgrd.rm.llvm.ctpop.i64(i64)
414 declare i32 @upgrd.rm.llvm.cttz.i8(i8)
416 declare i32 @upgrd.rm.llvm.cttz.i16(i16)
418 declare i32 @upgrd.rm.llvm.cttz.i32(i32)
420 declare i32 @upgrd.rm.llvm.cttz.i64(i64)
422 declare i32 @upgrd.rm.llvm.ctlz.i8(i8)
424 declare i32 @upgrd.rm.llvm.ctlz.i16(i16)
426 declare i32 @upgrd.rm.llvm.ctlz.i32(i32)
428 declare i32 @upgrd.rm.llvm.ctlz.i64(i64)
430 declare float @llvm.sqrt.f32(float)
432 declare double @llvm.sqrt.f64(double)
434 define void @libm() {
435 fcmp uno float 1.000000e+00, 2.000000e+00 ; <i1>:1 [#uses=0]
436 fcmp uno double 3.000000e+00, 4.000000e+00 ; <i1>:2 [#uses=0]
437 call void @llvm.prefetch( i8* null, i32 1, i32 3 )
438 call float @llvm.sqrt.f32( float 5.000000e+00 ) ; <float>:3 [#uses=0]
439 call double @llvm.sqrt.f64( double 6.000000e+00 ) ; <double>:4 [#uses=0]
440 call i32 @llvm.ctpop.i8( i8 10 ) ; <i32>:5 [#uses=1]
441 bitcast i32 %5 to i32 ; <i32>:6 [#uses=0]
442 call i32 @llvm.ctpop.i16( i16 11 ) ; <i32>:7 [#uses=1]
443 bitcast i32 %7 to i32 ; <i32>:8 [#uses=0]
444 call i32 @llvm.ctpop.i32( i32 12 ) ; <i32>:9 [#uses=1]
445 bitcast i32 %9 to i32 ; <i32>:10 [#uses=0]
446 call i32 @llvm.ctpop.i64( i64 13 ) ; <i32>:11 [#uses=1]
447 bitcast i32 %11 to i32 ; <i32>:12 [#uses=0]
448 call i32 @llvm.ctlz.i8( i8 14 ) ; <i32>:13 [#uses=1]
449 bitcast i32 %13 to i32 ; <i32>:14 [#uses=0]
450 call i32 @llvm.ctlz.i16( i16 15 ) ; <i32>:15 [#uses=1]
451 bitcast i32 %15 to i32 ; <i32>:16 [#uses=0]
452 call i32 @llvm.ctlz.i32( i32 16 ) ; <i32>:17 [#uses=1]
453 bitcast i32 %17 to i32 ; <i32>:18 [#uses=0]
454 call i32 @llvm.ctlz.i64( i64 17 ) ; <i32>:19 [#uses=1]
455 bitcast i32 %19 to i32 ; <i32>:20 [#uses=0]
456 call i32 @llvm.cttz.i8( i8 18 ) ; <i32>:21 [#uses=1]
457 bitcast i32 %21 to i32 ; <i32>:22 [#uses=0]
458 call i32 @llvm.cttz.i16( i16 19 ) ; <i32>:23 [#uses=1]
459 bitcast i32 %23 to i32 ; <i32>:24 [#uses=0]
460 call i32 @llvm.cttz.i32( i32 20 ) ; <i32>:25 [#uses=1]
461 bitcast i32 %25 to i32 ; <i32>:26 [#uses=0]
462 call i32 @llvm.cttz.i64( i64 21 ) ; <i32>:27 [#uses=1]
463 bitcast i32 %27 to i32 ; <i32>:28 [#uses=0]
467 declare i32 @llvm.ctpop.i8(i8)
469 declare i32 @llvm.ctpop.i16(i16)
471 declare i32 @llvm.ctpop.i32(i32)
473 declare i32 @llvm.ctpop.i64(i64)
475 declare i32 @llvm.ctlz.i8(i8)
477 declare i32 @llvm.ctlz.i16(i16)
479 declare i32 @llvm.ctlz.i32(i32)
481 declare i32 @llvm.ctlz.i64(i64)
483 declare i32 @llvm.cttz.i8(i8)
485 declare i32 @llvm.cttz.i16(i16)
487 declare i32 @llvm.cttz.i32(i32)
489 declare i32 @llvm.cttz.i64(i64)
491 ; ModuleID = 'packed.ll'
492 @foo1 = external global <4 x float> ; <<4 x float>*> [#uses=2]
493 @foo102 = external global <2 x i32> ; <<2 x i32>*> [#uses=2]
495 define void @main3() {
496 store <4 x float> < float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00 >, <4 x float>* @foo1
497 store <2 x i32> < i32 4, i32 4 >, <2 x i32>* @foo102
498 %l1 = load <4 x float>* @foo1 ; <<4 x float>> [#uses=0]
499 %l2 = load <2 x i32>* @foo102 ; <<2 x i32>> [#uses=0]
503 ; ModuleID = 'properties.ll'
504 target datalayout = "e-p:32:32"
505 target triple = "proc-vend-sys"
506 deplibs = [ "m", "c" ]
507 ; ModuleID = 'prototype.ll'
509 declare i32 @bar1017(i32 %in)
511 define i32 @foo1016(i32 %blah) {
512 %xx = call i32 @bar1017( i32 %blah ) ; <i32> [#uses=1]
516 ; ModuleID = 'recursivetype.ll'
517 %list = type { %list*, i32 }
519 declare i8* @malloc(i32)
521 define void @InsertIntoListTail(%list** %L, i32 %Data) {
523 %reg116 = load %list** %L ; <%list*> [#uses=1]
524 %cast1004 = inttoptr i64 0 to %list* ; <%list*> [#uses=1]
525 %cond1000 = icmp eq %list* %reg116, %cast1004 ; <i1> [#uses=1]
526 br i1 %cond1000, label %bb3, label %bb2
528 bb2: ; preds = %bb2, %bb1
529 %reg117 = phi %list** [ %reg118, %bb2 ], [ %L, %bb1 ] ; <%list**> [#uses=1]
530 %cast1010 = bitcast %list** %reg117 to %list*** ; <%list***> [#uses=1]
531 %reg118 = load %list*** %cast1010 ; <%list**> [#uses=3]
532 %reg109 = load %list** %reg118 ; <%list*> [#uses=1]
533 %cast1005 = inttoptr i64 0 to %list* ; <%list*> [#uses=1]
534 %cond1001 = icmp ne %list* %reg109, %cast1005 ; <i1> [#uses=1]
535 br i1 %cond1001, label %bb2, label %bb3
537 bb3: ; preds = %bb2, %bb1
538 %reg119 = phi %list** [ %reg118, %bb2 ], [ %L, %bb1 ] ; <%list**> [#uses=1]
539 %cast1006 = bitcast %list** %reg119 to i8** ; <i8**> [#uses=1]
540 %reg111 = call i8* @malloc( i32 16 ) ; <i8*> [#uses=3]
541 store i8* %reg111, i8** %cast1006
542 %reg111.upgrd.1 = ptrtoint i8* %reg111 to i64 ; <i64> [#uses=1]
543 %reg1002 = add i64 %reg111.upgrd.1, 8 ; <i64> [#uses=1]
544 %reg1002.upgrd.2 = inttoptr i64 %reg1002 to i8* ; <i8*> [#uses=1]
545 %cast1008 = bitcast i8* %reg1002.upgrd.2 to i32* ; <i32*> [#uses=1]
546 store i32 %Data, i32* %cast1008
547 %cast1003 = inttoptr i64 0 to i64* ; <i64*> [#uses=1]
548 %cast1009 = bitcast i8* %reg111 to i64** ; <i64**> [#uses=1]
549 store i64* %cast1003, i64** %cast1009
553 define %list* @FindData(%list* %L, i32 %Data) {
557 bb2: ; preds = %bb6, %bb1
558 %reg115 = phi %list* [ %reg116, %bb6 ], [ %L, %bb1 ] ; <%list*> [#uses=4]
559 %cast1014 = inttoptr i64 0 to %list* ; <%list*> [#uses=1]
560 %cond1011 = icmp ne %list* %reg115, %cast1014 ; <i1> [#uses=1]
561 br i1 %cond1011, label %bb4, label %bb3
567 %idx = getelementptr %list* %reg115, i64 0, i32 1 ; <i32*> [#uses=1]
568 %reg111 = load i32* %idx ; <i32> [#uses=1]
569 %cond1013 = icmp ne i32 %reg111, %Data ; <i1> [#uses=1]
570 br i1 %cond1013, label %bb6, label %bb5
576 %idx2 = getelementptr %list* %reg115, i64 0, i32 0 ; <%list**> [#uses=1]
577 %reg116 = load %list** %idx2 ; <%list*> [#uses=1]
580 ; ModuleID = 'simplecalltest.ll'
581 %FunTy = type i32 (i32)
583 define void @invoke1019(%FunTy* %x) {
584 %foo = call i32 %x( i32 123 ) ; <i32> [#uses=0]
588 define i32 @main4(i32 %argc, i8** %argv, i8** %envp) {
589 %retval = call i32 @test1008( i32 %argc ) ; <i32> [#uses=2]
590 %two = add i32 %retval, %retval ; <i32> [#uses=1]
591 %retval2 = call i32 @test1008( i32 %argc ) ; <i32> [#uses=1]
592 %two2 = add i32 %two, %retval2 ; <i32> [#uses=1]
593 call void @invoke1019( %FunTy* @test1008 )
597 define i32 @test1008(i32 %i0) {
600 ; ModuleID = 'smallest.ll'
601 ; ModuleID = 'small.ll'
604 define i32 @foo1020(i32 %in) {
608 ; ModuleID = 'testalloca.ll'
609 %inners = type { float, { i8 } }
610 %struct = type { i32, %inners, i64 }
612 define i32 @testfunction(i32 %i0, i32 %j0) {
613 alloca i8, i32 5 ; <i8*>:1 [#uses=0]
614 %ptr = alloca i32 ; <i32*> [#uses=2]
615 store i32 3, i32* %ptr
616 %val = load i32* %ptr ; <i32> [#uses=0]
617 %sptr = alloca %struct ; <%struct*> [#uses=2]
618 %nsptr = getelementptr %struct* %sptr, i64 0, i32 1 ; <%inners*> [#uses=1]
619 %ubsptr = getelementptr %inners* %nsptr, i64 0, i32 1 ; <{ i8 }*> [#uses=1]
620 %idx = getelementptr { i8 }* %ubsptr, i64 0, i32 0 ; <i8*> [#uses=1]
622 %fptr = getelementptr %struct* %sptr, i64 0, i32 1, i32 0 ; <float*> [#uses=1]
623 store float 4.000000e+00, float* %fptr
626 ; ModuleID = 'testconstants.ll'
627 @somestr3 = constant [11 x i8] c"hello world"
628 @array99 = constant [2 x i32] [ i32 12, i32 52 ]
629 constant { i32, i32 } { i32 4, i32 3 } ; <{ i32, i32 }*>:0 [#uses=0]
631 define [2 x i32]* @testfunction99(i32 %i0, i32 %j0) {
632 ret [2 x i32]* @array
635 define i8* @otherfunc(i32, double) {
636 %somestr = getelementptr [11 x i8]* @somestr3, i64 0, i64 0 ; <i8*> [#uses=1]
640 define i8* @yetanotherfunc(i32, double) {
644 define i32 @negativeUnsigned() {
648 define i32 @largeSigned() {
651 ; ModuleID = 'testlogical.ll'
653 define i32 @simpleAdd(i32 %i0, i32 %j0) {
654 %t1 = xor i32 %i0, %j0 ; <i32> [#uses=1]
655 %t2 = or i32 %i0, %j0 ; <i32> [#uses=1]
656 %t3 = and i32 %t1, %t2 ; <i32> [#uses=1]
659 ; ModuleID = 'testmemory.ll'
660 %complexty = type { i32, { [4 x i8*], float }, double }
661 %struct = type { i32, { float, { i8 } }, i64 }
663 define i32 @main6() {
664 call i32 @testfunction98( i64 0, i64 1 )
668 define i32 @testfunction98(i64 %i0, i64 %j0) {
669 %array0 = malloc [4 x i8] ; <[4 x i8]*> [#uses=2]
670 %size = add i32 2, 2 ; <i32> [#uses=1]
671 %array1 = malloc i8, i32 4 ; <i8*> [#uses=1]
672 %array2 = malloc i8, i32 %size ; <i8*> [#uses=1]
673 %idx = getelementptr [4 x i8]* %array0, i64 0, i64 2 ; <i8*> [#uses=1]
674 store i8 123, i8* %idx
675 free [4 x i8]* %array0
678 %aa = alloca %complexty, i32 5 ; <%complexty*> [#uses=1]
679 %idx2 = getelementptr %complexty* %aa, i64 %i0, i32 1, i32 0, i64 %j0 ; <i8**> [#uses=1]
680 store i8* null, i8** %idx2
681 %ptr = alloca i32 ; <i32*> [#uses=2]
682 store i32 3, i32* %ptr
683 %val = load i32* %ptr ; <i32> [#uses=0]
684 %sptr = alloca %struct ; <%struct*> [#uses=1]
685 %ubsptr = getelementptr %struct* %sptr, i64 0, i32 1, i32 1 ; <{ i8 }*> [#uses=1]
686 %idx3 = getelementptr { i8 }* %ubsptr, i64 0, i32 0 ; <i8*> [#uses=1]
687 store i8 4, i8* %idx3
690 ; ModuleID = 'testswitch.ll'
693 define i32 @squared(i32 %i0) {
694 switch i32 %i0, label %Default [
700 Default: ; preds = %0
712 ; ModuleID = 'testvarargs.ll'
714 declare i32 @printf(i8*, ...)
716 define i32 @testvarar() {
717 call i32 (i8*, ...)* @printf( i8* null, i32 12, i8 42 ) ; <i32>:1 [#uses=1]
720 ; ModuleID = 'undefined.ll'
721 @X2 = global i32 undef ; <i32*> [#uses=0]
723 declare i32 @atoi(i8*)
725 define i32 @test1009() {
729 define i32 @test1003() {
730 %X = add i32 undef, 1 ; <i32> [#uses=1]
733 ; ModuleID = 'unreachable.ll'
737 define i32 @foo1021() {
741 define double @xyz() {
745 ; ModuleID = 'varargs.ll'
747 declare void @llvm.va_start(i8* %ap)
749 declare void @llvm.va_copy(i8* %aq, i8* %ap)
751 declare void @llvm.va_end(i8* %ap)
753 define i32 @test1010(i32 %X, ...) {
754 %ap = alloca i8* ; <i8**> [#uses=4]
755 %va.upgrd.1 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
756 call void @llvm.va_start( i8* %va.upgrd.1 )
757 %tmp = va_arg i8** %ap, i32 ; <i32> [#uses=1]
758 %aq = alloca i8* ; <i8**> [#uses=2]
759 %va0.upgrd.2 = bitcast i8** %aq to i8* ; <i8*> [#uses=1]
760 %va1.upgrd.3 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
761 call void @llvm.va_copy( i8* %va0.upgrd.2, i8* %va1.upgrd.3 )
762 %va.upgrd.4 = bitcast i8** %aq to i8* ; <i8*> [#uses=1]
763 call void @llvm.va_end( i8* %va.upgrd.4 )
764 %va.upgrd.5 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
765 call void @llvm.va_end( i8* %va.upgrd.5 )
768 ; ModuleID = 'varargs_new.ll'
770 declare void @llvm.va_start(i8*)
772 declare void @llvm.va_copy(i8*, i8*)
774 declare void @llvm.va_end(i8*)
776 define i32 @test1011(i32 %X, ...) {
777 %ap = alloca i8* ; <i8**> [#uses=4]
778 %aq = alloca i8* ; <i8**> [#uses=2]
779 %va.upgrd.1 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
780 call void @llvm.va_start( i8* %va.upgrd.1 )
781 %tmp = va_arg i8** %ap, i32 ; <i32> [#uses=1]
782 %apv = load i8** %ap ; <i8*> [#uses=1]
783 %va0.upgrd.2 = bitcast i8** %aq to i8* ; <i8*> [#uses=1]
784 %va1.upgrd.3 = bitcast i8* %apv to i8* ; <i8*> [#uses=1]
785 call void @llvm.va_copy( i8* %va0.upgrd.2, i8* %va1.upgrd.3 )
786 %va.upgrd.4 = bitcast i8** %aq to i8* ; <i8*> [#uses=1]
787 call void @llvm.va_end( i8* %va.upgrd.4 )
788 %va.upgrd.5 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
789 call void @llvm.va_end( i8* %va.upgrd.5 )
792 ; ModuleID = 'weirdnames.ll'
794 @"%.*+ foo" = global "&^ " { i32 5 } ; <"&^ "*> [#uses=0]
795 @"0" = global float 0.000000e+00 ; <float*> [#uses=0]