1 ; RUN: llc < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPT %s
2 ; RUN: llc -O0 < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPTNONE %s
3 ; RUN: llc < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPT %s
4 ; RUN: llc -O0 < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPTNONE %s
6 ; RUN: llc --try-experimental-debuginfo-iterators < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPT %s
7 ; RUN: llc --try-experimental-debuginfo-iterators -O0 < %s -experimental-debug-variable-locations=false | FileCheck -check-prefixes=CHECK,OPTNONE %s
8 ; RUN: llc --try-experimental-debuginfo-iterators < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPT %s
9 ; RUN: llc --try-experimental-debuginfo-iterators -O0 < %s -experimental-debug-variable-locations=true | FileCheck -check-prefixes=CHECK,OPTNONE %s
11 ; Make sure we insert DW_OP_deref when spilling indirect DBG_VALUE instructions.
14 ; #define FORCE_SPILL() \
15 ; __asm volatile("" : : : \
16 ; "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "r8", \
17 ; "r9", "r10", "r11", "r12", "r13", "r14", "r15")
24 ; string get_string() {
30 ; CHECK-LABEL: _Z10get_stringv:
32 ; OPT: #DEBUG_VALUE: get_string:result <- [$rdi+0]
33 ; OPT: movq %rdi, [[OFFS:[0-9]+]](%rsp) # 8-byte Spill
34 ; OPT: #DEBUG_VALUE: get_string:result <- [DW_OP_plus_uconst [[OFFS]], DW_OP_deref] [$rsp+0]
35 ; OPT: callq _ZN6stringC1Ei
37 ; OPTNONE: #DEBUG_VALUE: get_string:result <- [DW_OP_deref] [$rsp+0]
38 ; OPTNONE: movq %rdi, %rax
39 ; OPTNONE: movq %rax, [[OFFS:[0-9]+]](%rsp) # 8-byte Spill
40 ; OPTNONE: #DEBUG_VALUE: get_string:result <- [$rdi+0]
41 ; OPTNONE: callq _ZN6stringC1Ei
47 source_filename = "t.cpp"
48 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
49 target triple = "x86_64--linux"
51 %struct.string = type { i32 }
53 ; Function Attrs: uwtable
54 define void @_Z10get_stringv(ptr noalias sret(%struct.string) %agg.result) #0 !dbg !7 {
56 %nrvo = alloca i1, align 1
57 store i1 false, ptr %nrvo, align 1, !dbg !24
58 call void @llvm.dbg.declare(metadata ptr %agg.result, metadata !23, metadata !DIExpression()), !dbg !25
59 call void @_ZN6stringC1Ei(ptr %agg.result, i32 3), !dbg !26
60 call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{rbp},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{dirflag},~{fpsr},~{flags}"() #3, !dbg !27, !srcloc !28
61 store i1 true, ptr %nrvo, align 1, !dbg !29
62 %nrvo.val = load i1, ptr %nrvo, align 1, !dbg !30
63 br i1 %nrvo.val, label %nrvo.skipdtor, label %nrvo.unused, !dbg !30
65 nrvo.unused: ; preds = %entry
66 call void @_ZN6stringD1Ev(ptr %agg.result), !dbg !30
67 br label %nrvo.skipdtor, !dbg !30
69 nrvo.skipdtor: ; preds = %nrvo.unused, %entry
73 ; Function Attrs: nounwind readnone speculatable
74 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
76 declare void @_ZN6stringC1Ei(ptr, i32) unnamed_addr
78 declare void @_ZN6stringD1Ev(ptr) unnamed_addr
80 attributes #0 = { uwtable }
81 attributes #1 = { nounwind readnone speculatable }
82 attributes #3 = { nounwind }
85 !llvm.module.flags = !{!3, !4, !5}
88 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
89 !1 = !DIFile(filename: "t.cpp", directory: "C:\5Csrc\5Cllvm-project\5Cbuild")
91 !3 = !{i32 2, !"Dwarf Version", i32 4}
92 !4 = !{i32 2, !"Debug Info Version", i32 3}
93 !5 = !{i32 1, !"wchar_size", i32 4}
94 !6 = !{!"clang version 6.0.0 "}
95 !7 = distinct !DISubprogram(name: "get_string", linkageName: "_Z10get_stringv", scope: !1, file: !1, line: 13, type: !8, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !22)
96 !8 = !DISubroutineType(types: !9)
98 !10 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "string", file: !1, line: 7, size: 32, elements: !11, identifier: "_ZTS6string")
99 !11 = !{!12, !14, !18, !21}
100 !12 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !10, file: !1, line: 11, baseType: !13, size: 32)
101 !13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
102 !14 = !DISubprogram(name: "string", scope: !10, file: !1, line: 8, type: !15, isLocal: false, isDefinition: false, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true)
103 !15 = !DISubroutineType(types: !16)
105 !17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
106 !18 = !DISubprogram(name: "string", scope: !10, file: !1, line: 9, type: !19, isLocal: false, isDefinition: false, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true)
107 !19 = !DISubroutineType(types: !20)
108 !20 = !{null, !17, !13}
109 !21 = !DISubprogram(name: "~string", scope: !10, file: !1, line: 10, type: !15, isLocal: false, isDefinition: false, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: true)
111 !23 = !DILocalVariable(name: "result", scope: !7, file: !1, line: 14, type: !10)
112 !24 = !DILocation(line: 14, column: 3, scope: !7)
113 !25 = !DILocation(line: 14, column: 10, scope: !7)
114 !26 = !DILocation(line: 14, column: 19, scope: !7)
115 !27 = !DILocation(line: 15, column: 3, scope: !7)
116 !28 = !{i32 -2147471175}
117 !29 = !DILocation(line: 16, column: 3, scope: !7)
118 !30 = !DILocation(line: 17, column: 1, scope: !7)