1; RUN: %llc_dwarf -filetype=obj -o %t.o < %s 2; RUN: llvm-dwarfdump %t.o | FileCheck %s 3 4;; Checks that when we have a set of debug values that are all different but 5;; result in identical DW_AT_location entries, we are able to merge them into a 6;; single DW_AT_location instead of producing a loclist with identical locations 7;; for each. 8 9;; Checks that we can merge a non-variadic debug value with an equivalent 10;; variadic debug value. 11; CHECK: DW_AT_location 12; CHECK-SAME: (DW_OP_fbreg +{{[0-9]+}}, DW_OP_deref, DW_OP_stack_value) 13; CHECK-NEXT: DW_AT_name ("Var2") 14 15target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 16target triple = "x86_64-unknown-linux-gnu" 17 18%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr } 19 20define i32 @_ZN4llvm9MCContext12GetDwarfFileENS_9StringRefES1_jj(ptr %this, ptr %A, i64 %B, ptr %C, i64 %D, i32 %E, i32 %CUID, i1 %cmp.i.i.i.i.i) !dbg !10 { 21entry: 22 %CUID.addr = alloca i32, align 4 23 store i32 %CUID, ptr %CUID.addr, align 4 24 call void @llvm.dbg.value(metadata ptr %CUID.addr, metadata !26, metadata !DIExpression(DW_OP_deref, DW_OP_stack_value)), !dbg !17 25 %0 = load ptr, ptr null, align 8, !dbg !18 26 call void @llvm.dbg.value(metadata !DIArgList(ptr %CUID.addr), metadata !26, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_deref, DW_OP_stack_value)), !dbg !18 27 br label %while.body.i.i.i.i 28 29while.body.i.i.i.i: ; preds = %while.body.i.i.i.i, %entry 30 %__x.addr.011.i.i.i.i = phi ptr [ %__x.addr.1.in.i.i.i.i, %while.body.i.i.i.i ], [ %0, %entry ] 31 %_M_right.i.i.i.i.i = getelementptr inbounds %"struct.std::_Rb_tree_node_base", ptr %__x.addr.011.i.i.i.i, i64 0, i32 3, !dbg !20 32 %__x.addr.1.in.i.i.i.i = select i1 %cmp.i.i.i.i.i, ptr %__x.addr.011.i.i.i.i, ptr null, !dbg !20 33 br label %while.body.i.i.i.i 34} 35 36declare void @llvm.dbg.value(metadata, metadata, metadata) 37 38!llvm.dbg.cu = !{!0} 39!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8} 40!llvm.ident = !{!9} 41 42!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 16.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) 43!1 = !DIFile(filename: "test.cpp", directory: "/") 44!2 = !{i32 7, !"Dwarf Version", i32 5} 45!3 = !{i32 2, !"Debug Info Version", i32 3} 46!4 = !{i32 1, !"wchar_size", i32 4} 47!5 = !{i32 8, !"PIC Level", i32 2} 48!6 = !{i32 7, !"PIE Level", i32 2} 49!7 = !{i32 7, !"uwtable", i32 2} 50!8 = !{i32 7, !"frame-pointer", i32 2} 51!9 = !{!"clang version 16.0.0"} 52!10 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooPi", scope: !1, file: !1, line: 1, type: !11, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !15) 53!11 = !DISubroutineType(types: !12) 54!12 = !{!13, !14} 55!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 56!14 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) 57!15 = !{} 58!16 = !DILocalVariable(name: "Var1", scope: !10, file: !1, line: 1, type: !14) 59!17 = !DILocation(line: 1, column: 14, scope: !10) 60!18 = !DILocation(line: 2, column: 3, scope: !10) 61!19 = !DILocation(line: 2, column: 5, scope: !10) 62!20 = !DILocation(line: 3, column: 10, scope: !10) 63!21 = !DILocation(line: 3, column: 9, scope: !10) 64!22 = !DILocation(line: 3, column: 2, scope: !10) 65!26 = !DILocalVariable(name: "Var2", scope: !10, file: !1, line: 1, type: !14) 66