1; RUN: llc -mtriple=x86_64-- %s -o - -O0 -stop-before=finalize-isel \ 2; RUN: -experimental-debug-variable-locations \ 3; RUN: | FileCheck %s --check-prefix=O0 --implicit-check-not=DBG_INSTR_REF 4; RUN: llc -mtriple=x86_64-- %s -o - -O2 -stop-before=finalize-isel \ 5; RUN: -experimental-debug-variable-locations \ 6; RUN: | FileCheck %s --check-prefix=O2 --implicit-check-not=DBG_VALUE 7; RUN: llc -mtriple=x86_64-- %s -o - -stop-before=finalize-isel \ 8; RUN: -fast-isel -experimental-debug-variable-locations \ 9; RUN: | FileCheck %s --check-prefix=FASTISEL --implicit-check-not=DBG_VALUE 10 11;; Repeat the tests using experimental debuginfo iterators. 12; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-- %s -o - -O0 -stop-before=finalize-isel \ 13; RUN: -experimental-debug-variable-locations \ 14; RUN: | FileCheck %s --check-prefix=O0 --implicit-check-not=DBG_INSTR_REF 15; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-- %s -o - -O2 -stop-before=finalize-isel \ 16; RUN: -experimental-debug-variable-locations \ 17; RUN: | FileCheck %s --check-prefix=O2 --implicit-check-not=DBG_VALUE 18; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-- %s -o - -stop-before=finalize-isel \ 19; RUN: -fast-isel -experimental-debug-variable-locations \ 20; RUN: | FileCheck %s --check-prefix=FASTISEL --implicit-check-not=DBG_VALUE 21 22; Test that instruction-referencing variable locations are issued at -O2, but 23; normal DBG_VALUEs are issued at -O0. This behaviour is desired as the former 24; is slow when applied to unoptimized code. 25; (Copy + pasted from ./dead-store-elimination-marks-undef.ll), 26 27; O0-LABEL: name: main 28; O0: DBG_VALUE 29; O0-LABEL: name: fn_optnone 30; O0: DBG_VALUE 31 32; O2-LABEL: name: main 33; O2: DBG_INSTR_REF 34; O2-LABEL: name: fn_optnone 35; O2: DBG_VALUE 36 37; FASTISEL-LABEL: name: main 38; FASTISEL: DBG_INSTR_REF 39; FASTISEL-LABEL: name: fn_optnone 40; FASTISEL: DBG_VALUE 41 42@b = common dso_local local_unnamed_addr global i32 0, align 1 43 44define dso_local i32 @main() local_unnamed_addr !dbg !7 { 45 %1 = alloca i32, align 4 46 %2 = load i32, ptr @b, align 1, !dbg !13 47 call void @llvm.dbg.value(metadata i32 %2, metadata !12, metadata !DIExpression()), !dbg !13 48 store i32 %2, ptr %1, align 4, !dbg !13 49 ret i32 0, !dbg !13 50} 51 52define dso_local i32 @fn_optnone() local_unnamed_addr #0 !dbg !27 { 53 %1 = alloca i32, align 4 54 %2 = load i32, ptr @b, align 1, !dbg !33 55 call void @llvm.dbg.value(metadata i32 %2, metadata !32, metadata !DIExpression()), !dbg !33 56 store i32 %2, ptr %1, align 4, !dbg !33 57 ret i32 0, !dbg !33 58} 59 60attributes #0 = {optnone noinline} 61 62declare void @llvm.dbg.value(metadata, metadata, metadata) 63 64!llvm.dbg.cu = !{!0} 65!llvm.module.flags = !{!3, !4} 66!llvm.ident = !{!6} 67 68!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !2, nameTableKind: None) 69!1 = !DIFile(filename: "dead-store-elimination-marks-undef.ll", directory: "/temp/bz45080") 70!2 = !{} 71!3 = !{i32 2, !"Dwarf Version", i32 4} 72!4 = !{i32 2, !"Debug Info Version", i32 3} 73!6 = !{!"clang version 10.0.0"} 74!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11) 75!8 = !DISubroutineType(types: !9) 76!9 = !{!10} 77!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 78!11 = !{!12} 79!12 = !DILocalVariable(name: "l_2864", scope: !7, file: !1, line: 4, type: !10) 80!13 = !DILocation(line: 5, column: 12, scope: !7) 81!27 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !31) 82!31 = !{!32} 83!32 = !DILocalVariable(name: "l_2864", scope: !27, file: !1, line: 4, type: !10) 84!33 = !DILocation(line: 5, column: 12, scope: !27) 85