1 ; RUN: opt -passes=debugify -S -o - < %s | FileCheck %s
2 ; RUN: opt -passes=debugify -S -o - < %s | FileCheck %s
4 ; RUN: opt -passes=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 -passes=debugify,check-debugify -S -o - < %s | \
10 ; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"
11 ; RUN: opt -passes=debugify,check-debugify -S -o - < %s | \
12 ; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"
13 ; RUN: opt -enable-debugify -passes=verify -S -o - < %s | \
14 ; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"
16 ; RUN: opt -passes=debugify,strip,check-debugify -S -o - < %s 2>&1 | \
17 ; RUN: FileCheck %s -check-prefix=CHECK-WARN
19 ; RUN: opt -enable-debugify -passes=strip -S -o - < %s 2>&1 | \
20 ; RUN: FileCheck %s -check-prefix=CHECK-WARN
22 ; RUN: opt -enable-debugify -S -o - < %s 2>&1 | FileCheck %s -check-prefix=PASS
24 ; Verify that debugify can be safely used with piping
25 ; RUN: opt -enable-debugify -O1 < %s | opt -O2 -o /dev/null
26 ; RUN: opt -passes=debugify,mem2reg,check-debugify < %s | opt -O2 -o /dev/null
28 ;; Perform the same checks again for intrinsic debug info
29 ; RUN: opt --experimental-debuginfo-iterators=false -passes=debugify -S -o - < %s | FileCheck %s
30 ; RUN: opt --experimental-debuginfo-iterators=false -passes=debugify -S -o - < %s | FileCheck %s
32 ; RUN: opt --experimental-debuginfo-iterators=false -passes=debugify,debugify -S -o - < %s 2>&1 | \
33 ; RUN: FileCheck %s -check-prefix=CHECK-REPEAT
34 ; RUN: opt --experimental-debuginfo-iterators=false -passes=debugify,debugify -S -o - < %s 2>&1 | \
35 ; RUN: FileCheck %s -check-prefix=CHECK-REPEAT
37 ; RUN: opt --experimental-debuginfo-iterators=false -passes=debugify,check-debugify -S -o - < %s | \
38 ; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"
39 ; RUN: opt --experimental-debuginfo-iterators=false -passes=debugify,check-debugify -S -o - < %s | \
40 ; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"
41 ; RUN: opt --experimental-debuginfo-iterators=false -enable-debugify -passes=verify -S -o - < %s | \
42 ; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"
44 ; RUN: opt --experimental-debuginfo-iterators=false -passes=debugify,strip,check-debugify -S -o - < %s 2>&1 | \
45 ; RUN: FileCheck %s -check-prefix=CHECK-WARN
47 ; RUN: opt --experimental-debuginfo-iterators=false -enable-debugify -passes=strip -S -o - < %s 2>&1 | \
48 ; RUN: FileCheck %s -check-prefix=CHECK-WARN
50 ; RUN: opt --experimental-debuginfo-iterators=false -enable-debugify -S -o - < %s 2>&1 | FileCheck %s -check-prefix=PASS
52 ; RUN: opt --experimental-debuginfo-iterators=false -enable-debugify -O1 < %s | opt -O2 -o /dev/null
53 ; RUN: opt --experimental-debuginfo-iterators=false -passes=debugify,mem2reg,check-debugify < %s | opt -O2 -o /dev/null
55 ; CHECK-LABEL: define void @foo
57 ; CHECK: ret void, !dbg ![[RET1:.*]]
61 ; CHECK-LABEL: define i32 @bar
63 ; CHECK: call void @foo(), !dbg ![[CALL1:.*]]
66 ; CHECK: add i32 0, 1, !dbg ![[ADD1:.*]]
69 ; CHECK: ret i32 0, !dbg ![[RET2:.*]]
73 ; CHECK-LABEL: define weak_odr zeroext i1 @baz
74 define weak_odr zeroext i1 @baz() {
79 ; CHECK-LABEL: define i32 @boom
81 ; CHECK: [[result:%.*]] = musttail call i32 @bar(), !dbg ![[musttail:.*]]
82 %retval = musttail call i32 @bar()
83 ; CHECK-NEXT: ret i32 [[result]], !dbg ![[musttailRes:.*]]
87 ; CHECK-DAG: !llvm.dbg.cu = !{![[CU:.*]]}
88 ; CHECK-DAG: !llvm.debugify = !{![[NUM_INSTS:.*]], ![[NUM_VARS:.*]]}
89 ; CHECK-DAG: "Debug Info Version"
91 ; CHECK-DAG: ![[CU]] = distinct !DICompileUnit(language: DW_LANG_C, file: {{.*}}, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
92 ; CHECK-DAG: !DIFile(filename: "<stdin>", directory: "/")
93 ; CHECK-DAG: distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: {{.*}}, line: 1, type: {{.*}}, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: {{.*}}, retainedNodes: {{.*}})
94 ; CHECK-DAG: distinct !DISubprogram(name: "bar", linkageName: "bar", scope: null, file: {{.*}}, line: 2, type: {{.*}}, scopeLine: 2, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: {{.*}}, retainedNodes: {{.*}})
97 ; CHECK-DAG: ![[RET1]] = !DILocation(line: 1, column: 1
98 ; CHECK-DAG: ![[CALL1]] = !DILocation(line: 2, column: 1
99 ; CHECK-DAG: ![[ADD1]] = !DILocation(line: 3, column: 1
100 ; CHECK-DAG: ![[RET2]] = !DILocation(line: 4, column: 1
101 ; CHECK-DAG: ![[musttail]] = !DILocation(line: 5, column: 1
102 ; CHECK-DAG: ![[musttailRes]] = !DILocation(line: 6, column: 1
104 ; --- DILocalVariables
105 ; CHECK-DAG: ![[TY32:.*]] = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
106 ; CHECK-DAG: !DILocalVariable(name: "1", scope: {{.*}}, file: {{.*}}, line: 1, type: ![[TY32]])
107 ; CHECK-DAG: !DILocalVariable(name: "2", scope: {{.*}}, file: {{.*}}, line: 3, type: ![[TY32]])
108 ; CHECK-DAG: !DILocalVariable(name: "3", scope: {{.*}}, file: {{.*}}, line: 5, type: ![[TY32]])
110 ; --- Metadata counts
111 ; CHECK-DAG: ![[NUM_INSTS]] = !{i32 6}
112 ; CHECK-DAG: ![[NUM_VARS]] = !{i32 3}
115 ; CHECK-REPEAT: ModuleDebugify: Skipping module with debug info
118 ; CHECK-WARN: WARNING: Instruction with empty DebugLoc in function foo -- ret void
119 ; CHECK-WARN: WARNING: Instruction with empty DebugLoc in function bar -- call void @foo()
120 ; CHECK-WARN: WARNING: Instruction with empty DebugLoc in function bar -- {{.*}} add i32 0, 1
121 ; CHECK-WARN: WARNING: Instruction with empty DebugLoc in function bar -- ret i32 0
122 ; CHECK-WARN: WARNING: Missing line 1
123 ; CHECK-WARN: WARNING: Missing line 2
124 ; CHECK-WARN: WARNING: Missing line 3
125 ; CHECK-WARN: WARNING: Missing line 4
126 ; CHECK-WARN: WARNING: Missing variable 1
127 ; CHECK-WARN: CheckModuleDebugify: PASS
129 ; PASS: CheckModuleDebugify: PASS