1 ; RUN: opt -debugify -S -o - < %s | FileCheck %s
2 ; RUN: opt -passes=debugify -S -o - < %s | FileCheck %s
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
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"
16 ; RUN: opt -debugify -strip -check-debugify -S -o - < %s | \
17 ; RUN: FileCheck %s -check-prefix=CHECK-FAIL
19 ; RUN: opt -enable-debugify -strip -S -o - < %s | \
20 ; RUN: FileCheck %s -check-prefix=CHECK-FAIL
22 ; RUN: opt -enable-debugify -S -o - < %s | FileCheck %s -check-prefix=PASS
24 ; CHECK-LABEL: define void @foo
26 ; CHECK: ret void, !dbg ![[RET1:.*]]
30 ; CHECK-LABEL: define i32 @bar
32 ; CHECK: call void @foo(), !dbg ![[CALL1:.*]]
35 ; CHECK: add i32 0, 1, !dbg ![[ADD1:.*]]
38 ; CHECK: ret i32 0, !dbg ![[RET2:.*]]
42 ; CHECK-LABEL: define weak_odr zeroext i1 @baz
43 define weak_odr zeroext i1 @baz() {
48 ; CHECK-DAG: !llvm.dbg.cu = !{![[CU:.*]]}
49 ; CHECK-DAG: !llvm.debugify = !{![[NUM_INSTS:.*]], ![[NUM_VARS:.*]]}
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: {{.*}})
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
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]])
67 ; CHECK-DAG: ![[NUM_INSTS]] = !{i32 4}
68 ; CHECK-DAG: ![[NUM_VARS]] = !{i32 1}
71 ; CHECK-REPEAT: Debugify: Skipping module with debug info
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
85 ; PASS: CheckDebugify: PASS