OSDN Git Service

[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
[android-x86/external-llvm.git] / test / DebugInfo / debugify.ll
1 ; RUN: opt -debugify -S -o - < %s | FileCheck %s
2 ; RUN: opt -passes=debugify -S -o - < %s | FileCheck %s
3
4 ; RUN: opt -debugify -debugify -S -o - < %s 2>&1 | \
5 ; RUN:   FileCheck %s -check-prefix=CHECK-REPEAT
6 ; RUN: opt -passes=debugify,debugify -S -o - < %s 2>&1 | \
7 ; RUN:   FileCheck %s -check-prefix=CHECK-REPEAT
8
9 ; RUN: opt -debugify -check-debugify -S -o - < %s | \
10 ; RUN:   FileCheck %s -implicit-check-not="CheckDebugify: FAIL"
11 ; RUN: opt -passes=debugify,check-debugify -S -o - < %s | \
12 ; RUN:   FileCheck %s -implicit-check-not="CheckDebugify: FAIL"
13 ; RUN: opt -enable-debugify -passes=verify -S -o - < %s | \
14 ; RUN:   FileCheck %s -implicit-check-not="CheckDebugify: FAIL"
15
16 ; RUN: opt -debugify -strip -check-debugify -S -o - < %s | \
17 ; RUN:   FileCheck %s -check-prefix=CHECK-FAIL
18
19 ; RUN: opt -enable-debugify -strip -S -o - < %s | \
20 ; RUN:   FileCheck %s -check-prefix=CHECK-FAIL
21
22 ; RUN: opt -enable-debugify -S -o - < %s | FileCheck %s -check-prefix=PASS
23
24 ; CHECK-LABEL: define void @foo
25 define void @foo() {
26 ; CHECK: ret void, !dbg ![[RET1:.*]]
27   ret void
28 }
29
30 ; CHECK-LABEL: define i32 @bar
31 define i32 @bar() {
32 ; CHECK: call void @foo(), !dbg ![[CALL1:.*]]
33   call void @foo()
34
35 ; CHECK: add i32 0, 1, !dbg ![[ADD1:.*]]
36   %sum = add i32 0, 1
37
38 ; CHECK: ret i32 0, !dbg ![[RET2:.*]]
39   ret i32 0
40 }
41
42 ; CHECK-LABEL: define weak_odr zeroext i1 @baz
43 define weak_odr zeroext i1 @baz() {
44 ; CHECK-NOT: !dbg
45   ret i1 false
46 }
47
48 ; CHECK-DAG: !llvm.dbg.cu = !{![[CU:.*]]}
49 ; CHECK-DAG: !llvm.debugify = !{![[NUM_INSTS:.*]], ![[NUM_VARS:.*]]}
50
51 ; CHECK-DAG: ![[CU]] = distinct !DICompileUnit(language: DW_LANG_C, file: {{.*}}, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: {{.*}})
52 ; CHECK-DAG: !DIFile(filename: "<stdin>", directory: "/")
53 ; CHECK-DAG: distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: {{.*}}, line: 1, type: {{.*}}, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: {{.*}}, retainedNodes: {{.*}})
54 ; CHECK-DAG: distinct !DISubprogram(name: "bar", linkageName: "bar", scope: null, file: {{.*}}, line: 2, type: {{.*}}, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: true, unit: {{.*}}, retainedNodes: {{.*}})
55
56 ; --- DILocations
57 ; CHECK-DAG: ![[RET1]] = !DILocation(line: 1, column: 1
58 ; CHECK-DAG: ![[CALL1]] = !DILocation(line: 2, column: 1
59 ; CHECK-DAG: ![[ADD1]] = !DILocation(line: 3, column: 1
60 ; CHECK-DAG: ![[RET2]] = !DILocation(line: 4, column: 1
61
62 ; --- DILocalVariables
63 ; CHECK-DAG: ![[TY32:.*]] = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
64 ; CHECK-DAG: !DILocalVariable(name: "1", scope: {{.*}}, file: {{.*}}, line: 3, type: ![[TY32]])
65
66 ; --- Metadata counts
67 ; CHECK-DAG: ![[NUM_INSTS]] = !{i32 4}
68 ; CHECK-DAG: ![[NUM_VARS]] = !{i32 1}
69
70 ; --- Repeat case
71 ; CHECK-REPEAT: Debugify: Skipping module with debug info
72
73 ; --- Failure case
74 ; CHECK-FAIL: ERROR: Instruction with empty DebugLoc --   ret void
75 ; CHECK-FAIL: ERROR: Instruction with empty DebugLoc --   call void @foo()
76 ; CHECK-FAIL: ERROR: Instruction with empty DebugLoc --   {{.*}} add i32 0, 1
77 ; CHECK-FAIL: ERROR: Instruction with empty DebugLoc --   ret i32 0
78 ; CHECK-FAIL: WARNING: Missing line 1
79 ; CHECK-FAIL: WARNING: Missing line 2
80 ; CHECK-FAIL: WARNING: Missing line 3
81 ; CHECK-FAIL: WARNING: Missing line 4
82 ; CHECK-FAIL: ERROR: Missing variable 1
83 ; CHECK-FAIL: CheckDebugify: FAIL
84
85 ; PASS: CheckDebugify: PASS