Use opt -S instead of piping bitcode output through llvm-dis.
[oota-llvm.git] / test / DebugInfo / 2009-06-15-InlineFuncStart.ll
1 ; Test inlined function handling. This test case is copied from 
2 ; 2009-06-12-InlineFunctStart.ll with one change. In function main, the bb1
3 ; does not have llvm.dbg.stoppiont intrinsic before llvm.dbg.func.start.
4 ; RUN: llvm-as < %s | llc
5 ; RUN: llc %s -o - -O0
6         %llvm.dbg.anchor.type = type { i32, i32 }
7         %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
8         %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* }
9         %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
10 @llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata"               ; <%llvm.dbg.subprogram.type*> [#uses=1]
11 @llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata"         ; <%llvm.dbg.anchor.type*> [#uses=1]
12 @llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 393233, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata"                ; <%llvm.dbg.compile_unit.type*> [#uses=1]
13 @llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata"               ; <%llvm.dbg.anchor.type*> [#uses=1]
14 @.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata"           ; <[4 x i8]*> [#uses=1]
15 @.str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata"         ; <[5 x i8]*> [#uses=1]
16 @.str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5627) (LLVM build)\00", section "llvm.metadata"         ; <[52 x i8]*> [#uses=1]
17 @.str3 = internal constant [4 x i8] c"foo\00", section "llvm.metadata"          ; <[4 x i8]*> [#uses=1]
18 @llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata"         ; <%llvm.dbg.basictype.type*> [#uses=1]
19 @.str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata"          ; <[4 x i8]*> [#uses=1]
20 @llvm.dbg.subprogram5 = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata"              ; <%llvm.dbg.subprogram.type*> [#uses=1]
21 @.str6 = internal constant [5 x i8] c"main\00", section "llvm.metadata"         ; <[5 x i8]*> [#uses=1]
22
23 define i32 @foo() nounwind alwaysinline {
24 entry:
25         %retval = alloca i32            ; <i32*> [#uses=2]
26         %0 = alloca i32         ; <i32*> [#uses=2]
27         %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
28         call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
29         call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
30         store i32 42, i32* %0, align 4
31         %1 = load i32* %0, align 4              ; <i32> [#uses=1]
32         store i32 %1, i32* %retval, align 4
33         br label %return
34
35 return:         ; preds = %entry
36         %retval1 = load i32* %retval            ; <i32> [#uses=1]
37         call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
38         call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
39         ret i32 %retval1
40 }
41
42 declare void @llvm.dbg.func.start({ }*) nounwind
43
44 declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
45
46 declare void @llvm.dbg.region.end({ }*) nounwind
47
48 define i32 @main() nounwind {
49 entry:
50         %retval.i = alloca i32          ; <i32*> [#uses=2]
51         %0 = alloca i32         ; <i32*> [#uses=2]
52         %retval = alloca i32            ; <i32*> [#uses=2]
53         %1 = alloca i32         ; <i32*> [#uses=2]
54         %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
55         call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram5 to { }*))
56         br label %bb1
57
58 return:         ; preds = %entry
59         %retval1 = load i32* %retval            ; <i32> [#uses=1]
60         call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
61         call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram5 to { }*))
62         ret i32 %retval1
63
64 bb1:
65         call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) nounwind
66         call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind
67         store i32 42, i32* %0, align 4
68         %2 = load i32* %0, align 4              ; <i32> [#uses=1]
69         store i32 %2, i32* %retval.i, align 4
70         %retval1.i = load i32* %retval.i                ; <i32> [#uses=1]
71         call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind
72         call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) nounwind
73         store i32 %retval1.i, i32* %1, align 4
74         %3 = load i32* %1, align 4              ; <i32> [#uses=1]
75         store i32 %3, i32* %retval, align 4
76         br label %return
77 }