1; RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -stop-before=finalize-isel \ 2; RUN: | FileCheck %s --check-prefix=NORMAL-INPUT 3 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 7 8; RUN: llc %s -mtriple=x86_64-unknown-unknown -o - -stop-after=livedebugvars \ 9; RUN: | FileCheck %s --check-prefix=OUTPUT 10 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 14 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. 18 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. 22 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 26; stripped. 27 28; Generated from: 29; 30; extern int foobar(); 31; 32; int bar(int a) { 33; int b = 10; 34; b += foobar(); 35; label: 36; if (a) goto label; 37; return b; 38; } 39; 40; __attribute__((nodebug)) 41; int foo(int a) { 42; return bar(a); 43; } 44 45; NORMAL-INPUT-DAG: DBG_VALUE 46; NORMAL-INPUT-DAG: DBG_LABEL 47 48; EXPER-INPUT-DAG: DBG_INSTR_REF 49; EXPER-INPUT-DAG: DBG_LABEL 50 51; OUTPUT-NOT: DBG_VALUE 52; OUTPUT-NOT: DBG_INSTR_REF 53; OUTPUT-NOT: DBG_LABEL 54 55target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 56target triple = "x86_64-unknown-linux-gnu" 57 58define dso_local i32 @_Z3fooi(i32 %a) local_unnamed_addr #0 { 59entry: 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 66 67label.i: ; preds = %entry, %label.i 68 call void @llvm.dbg.label(metadata !14), !dbg !18 69 br label %label.i 70 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 74 ret i32 %add.i 75} 76 77declare void @llvm.dbg.value(metadata, metadata, metadata) #2 78declare dso_local i32 @_Z6foobarv() local_unnamed_addr #1 79declare void @llvm.dbg.label(metadata) #2 80 81!llvm.dbg.cu = !{!0} 82!llvm.module.flags = !{!3, !4, !5} 83!llvm.ident = !{!6} 84 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: "") 87!2 = !{} 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) 94!9 = !{!10, !10} 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) 102