1 ; RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -stop-before=finalize-isel \
2 ; RUN: | FileCheck %s --check-prefix=NORMAL-INPUT
4 ; RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -stop-before=finalize-isel \
5 ; RUN: -experimental-debug-variable-locations \
6 ; RUN: | FileCheck %s --check-prefix=EXPER-INPUT
8 ; RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -stop-after=livedebugvars \
9 ; RUN: | FileCheck %s --check-prefix=OUTPUT
11 ; RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -stop-after=livedebugvars \
12 ; RUN: -experimental-debug-variable-locations \
13 ; RUN: | FileCheck %s --check-prefix=OUTPUT
15 ; This test checks that LiveDebugVariables strips all debug instructions
16 ; from nodebug functions. Such instructions occur when a function with debug
17 ; info is inlined into a nodebug function.
19 ; The test first verifies that DBG_VALUE/DBG_LABEL instructions are present in
20 ; the input to LiveDebugVariables. It then verifies that after the pass is ran
21 ; no debug instructions are present.
23 ; When -experimental-debug-variable-locations is enabled, certain variable
24 ; locations are represented by DBG_INSTR_REF instead of DBG_VALUE. The test
25 ; verifies that a DBG_INSTR_REF is emitted by the option, and that it is also
30 ; extern int foobar();
40 ; __attribute__((nodebug))
45 ; NORMAL-INPUT-DAG: DBG_VALUE
46 ; NORMAL-INPUT-DAG: DBG_LABEL
48 ; EXPER-INPUT-DAG: DBG_INSTR_REF
49 ; EXPER-INPUT-DAG: DBG_LABEL
51 ; OUTPUT-NOT: DBG_VALUE
52 ; OUTPUT-NOT: DBG_INSTR_REF
53 ; OUTPUT-NOT: DBG_LABEL
55 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
56 target triple = "x86_64-unknown-linux-gnu"
58 define dso_local i32 @_Z3fooi(i32 %a) local_unnamed_addr #0 {
60 call void @llvm.dbg.value(metadata i32 %a, metadata !12, metadata !DIExpression()), !dbg !15
61 call void @llvm.dbg.value(metadata i32 10, metadata !13, metadata !DIExpression()), !dbg !15
62 %call.i = tail call i32 @_Z6foobarv()
63 call void @llvm.dbg.value(metadata i32 undef, metadata !13, metadata !DIExpression()), !dbg !15
64 %tobool.not.i = icmp eq i32 %a, 0
65 br i1 %tobool.not.i, label %_Z3bari.exit, label %label.i
67 label.i: ; preds = %entry, %label.i
68 call void @llvm.dbg.label(metadata !14), !dbg !18
71 _Z3bari.exit: ; preds = %entry
72 %add.i = add nsw i32 %call.i, 10
73 call void @llvm.dbg.value(metadata i32 %add.i, metadata !13, metadata !DIExpression()), !dbg !15
77 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
78 declare dso_local i32 @_Z6foobarv() local_unnamed_addr #1
79 declare void @llvm.dbg.label(metadata) #2
82 !llvm.module.flags = !{!3, !4, !5}
85 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
86 !1 = !DIFile(filename: "f.cpp", directory: "")
88 !3 = !{i32 7, !"Dwarf Version", i32 4}
89 !4 = !{i32 2, !"Debug Info Version", i32 3}
90 !5 = !{i32 1, !"wchar_size", i32 4}
91 !6 = !{!"clang version 12.0.0"}
92 !7 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
93 !8 = !DISubroutineType(types: !9)
95 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
96 !11 = !{!12, !13, !14}
97 !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 3, type: !10)
98 !13 = !DILocalVariable(name: "b", scope: !7, file: !1, line: 4, type: !10)
99 !14 = !DILabel(scope: !7, name: "label", file: !1, line: 6)
100 !15 = !DILocation(line: 0, scope: !7)
101 !18 = !DILocation(line: 6, column: 1, scope: !7)