1 ; Test DBG_LABEL MachineInstr for label debugging.
3 ; RUN: llc -debug-only=isel %s -o /dev/null 2> %t.debug
4 ; RUN: cat %t.debug | FileCheck %s --check-prefix=CHECKMI
6 ; CHECKMI: DBG_LABEL "top", debug-location !9
7 ; CHECKMI: DBG_LABEL "done", debug-location !11
9 ; RUN: llc %s -o - | FileCheck %s --check-prefix=CHECKASM
11 ; CHECKASM: DEBUG_LABEL: foo:top
12 ; CHECKASM: DEBUG_LABEL: foo:done
14 source_filename = "debug-label-mi.c"
16 ; Function Attrs: noinline nounwind optnone
17 define i32 @foo(i32 signext %a, i32 signext %b) #0 !dbg !4 {
19 %a.addr = alloca i32, align 4
20 %b.addr = alloca i32, align 4
21 %sum = alloca i32, align 4
22 store i32 %a, i32* %a.addr, align 4
23 store i32 %b, i32* %b.addr, align 4
27 call void @llvm.dbg.label(metadata !8), !dbg !9
28 %0 = load i32, i32* %a.addr, align 4
29 %1 = load i32, i32* %b.addr, align 4
30 %add = add nsw i32 %0, %1
31 store i32 %add, i32* %sum, align 4
35 call void @llvm.dbg.label(metadata !10), !dbg !11
36 %2 = load i32, i32* %sum, align 4
40 ; Function Attrs: nounwind readnone speculatable
41 declare void @llvm.dbg.label(metadata)
43 attributes #0 = { noinline nounwind optnone uwtable }
46 !llvm.module.flags = !{!3}
48 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, emissionKind: FullDebug, enums: !2)
49 !1 = !DIFile(filename: "debug-label-mi.c", directory: "./")
51 !3 = !{i32 2, !"Debug Info Version", i32 3}
52 !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !2)
53 !5 = !DISubroutineType(types: !6)
55 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
56 !8 = !DILabel(scope: !4, name: "top", file: !1, line: 4)
57 !9 = !DILocation(line: 4, column: 1, scope: !4)
58 !10 = !DILabel(scope: !4, name: "done", file: !1, line: 7)
59 !11 = !DILocation(line: 7, column: 1, scope: !4)