blob: 9eb56e424b0313e4b98445e44c9e1012127b30a5 [file] [log] [blame]
Shiva Chen2c864552018-05-09 02:40:45 +00001; Test bitcode writer/reader for DILabel metadata.
2; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
3; RUN: verify-uselistorder %s
4;
5; CHECK: top:
6; CHECK: call void @llvm.dbg.label(metadata [[LABEL_METADATA:![0-9]+]])
7; CHECK: distinct !DISubprogram(name: "foo", {{.*}}, retainedNodes: [[ELEMENTS:![0-9]+]])
8; CHECK: [[ELEMENTS]] = !{[[LABEL_METADATA]]}
9; CHECK: [[LABEL_METADATA]] = !DILabel({{.*}}, name: "top", {{.*}}, line: 4)
10
11source_filename = "debug-label-bitcode.c"
12
13; Function Attrs: noinline nounwind optnone
14define i32 @foo(i32 signext %a, i32 signext %b) !dbg !4 {
15entry:
16 %a.addr = alloca i32, align 4
17 %b.addr = alloca i32, align 4
18 %sum = alloca i32, align 4
19 store i32 %a, i32* %a.addr, align 4
20 store i32 %b, i32* %b.addr, align 4
21 br label %top
22
23top: ; preds = %entry
24 call void @llvm.dbg.label(metadata !9), !dbg !10
25 %0 = load i32, i32* %a.addr, align 4
26 %1 = load i32, i32* %b.addr, align 4
27 %add = add nsw i32 %0, %1
28 store i32 %add, i32* %sum, align 4
29 br label %done
30
31done: ; preds = %top
32 call void @llvm.dbg.label(metadata !11), !dbg !12
33 %2 = load i32, i32* %sum, align 4
34 ret i32 %2
35}
36
37; Function Attrs: nounwind readnone speculatable
38declare void @llvm.dbg.label(metadata)
39
40!llvm.dbg.cu = !{!0}
41!llvm.module.flags = !{!3}
42
43!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang 6.0.0", isOptimized: false, emissionKind: FullDebug, enums: !2)
44!1 = !DIFile(filename: "debug-label-bitcode.c", directory: "./")
45!2 = !{}
46!3 = !{i32 2, !"Debug Info Version", i32 3}
47!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !5)
48!5 = !{!9}
49!6 = !DISubroutineType(types: !7)
50!7 = !{!8, !8, !8}
51!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
52!9 = !DILabel(scope: !4, name: "top", file: !1, line: 4)
53!10 = !DILocation(line: 4, column: 1, scope: !4)
54!11 = !DILabel(scope: !4, name: "done", file: !1, line: 7)
55!12 = !DILocation(line: 7, column: 1, scope: !4)