1; RUN: llc %s -stop-after=finalize-isel -o - \ 2; RUN: | FileCheck %s 3 4 5; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - \ 6; RUN: | FileCheck %s 7 8;; Handwritten test. 9 10;; Here we have dbg.assign intrinsics with fragments (in the value-expression) 11;; and address-expressions that involve arithmetic. The generated DBG_VALUE 12;; intructions needs a DIExpression that: 13;; a) Uses the fragment from the value-expression, 14;; b) Uses the offset expression of the address-expression, 15;; c) Has a DW_OP_deref appended. 16 17; CHECK: DBG_VALUE %stack.0.a, $noreg, {{.+}}, !DIExpression(DW_OP_plus_uconst, 8, DW_OP_deref, DW_OP_LLVM_fragment, 64, 32), debug-location 18 19target triple = "x86_64-unknown-linux-gnu" 20 21define dso_local void @fun() !dbg !7 { 22entry: 23 %a = alloca <4 x i32>, !DIAssignID !24 24 call void @llvm.dbg.assign(metadata i32 undef, metadata !16, metadata !DIExpression(), metadata !24, metadata ptr %a, metadata !DIExpression()), !dbg !34 25 ;; unlink and undef a dbg.assign to avoid using sidetable for var loc. 26 call void @llvm.dbg.assign(metadata i32 undef, metadata !16, metadata !DIExpression(), metadata !26, metadata ptr undef, metadata !DIExpression()), !dbg !34 27 %idx2 = getelementptr inbounds i32, ptr %a, i32 2 28 store i32 100, ptr %idx2, !DIAssignID !25 29 call void @llvm.dbg.assign(metadata i32 100, metadata !16, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32), metadata !25, metadata ptr %a, metadata !DIExpression(DW_OP_plus_uconst, 8)), !dbg !34 30 ret void 31} 32 33declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) 34 35!llvm.dbg.cu = !{!0} 36!llvm.module.flags = !{!3, !4, !5, !1000} 37!llvm.ident = !{!6} 38 39!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) 40!1 = !DIFile(filename: "test.cpp", directory: "/") 41!2 = !{} 42!3 = !{i32 7, !"Dwarf Version", i32 4} 43!4 = !{i32 2, !"Debug Info Version", i32 3} 44!5 = !{i32 1, !"wchar_size", i32 4} 45!6 = !{!"clang version 12.0.0"} 46!7 = distinct !DISubprogram(name: "fun", linkageName: "fun", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11) 47!8 = !DISubroutineType(types: !9) 48!9 = !{null, !10, !10, !10, !10} 49!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 50!11 = !{!16} 51!16 = !DILocalVariable(name: "quad", scope: !7, file: !1, line: 4, type: !17) 52!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 128, elements: !18) 53!18 = !{!19} 54!19 = !DISubrange(count: 4) 55!23 = !DILocation(line: 0, scope: !7) 56!24 = distinct !DIAssignID() 57!25 = distinct !DIAssignID() 58!26 = distinct !DIAssignID() 59!34 = !DILocation(line: 0, column: 0, scope: !7) 60!44 = !{!45, !45, i64 0} 61!45 = !{!"float", !46, i64 0} 62!46 = !{!"omnipotent char", !47, i64 0} 63!47 = !{!"Simple C++ TBAA"} 64!48 = !DILocation(line: 11, column: 3, scope: !7) 65!49 = !DILocation(line: 12, column: 1, scope: !7) 66!50 = !DISubprogram(name: "get", linkageName: "_Z3getv", scope: !1, file: !1, line: 1, type: !51, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 67!51 = !DISubroutineType(types: !52) 68!52 = !{!10} 69!53 = !DISubprogram(name: "ext", linkageName: "_Z3extPf", scope: !1, file: !1, line: 2, type: !54, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 70!54 = !DISubroutineType(types: !55) 71!55 = !{!10, !56} 72!56 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64) 73 74!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true} 75