1; RUN: llc -mtriple=x86_64-pc-linux-gnu -O2 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s 2 3; This reproducer is based on the following C code: 4; 5; typedef struct { int a; int b; } S; 6; 7; extern int ext(int); 8; 9; int foo() { 10; S s = {123, 456}; 11; ext(1); 12; s.a = ext(2); 13; ext(3); 14; s.a = 789; 15; return s.b; 16; } 17; 18; and was generated using -O2 -g -fno-inline. 19; 20; As a small note, the third dbg.value's value has been changed from %call1 to 21; undef (it would have become undef either way, but this was done to make the 22; intention of the test a bit more clear). 23 24; Verify that a location list entry describing s.b is started at the 25; non-overlapping undef debug value. 26 27; CHECK: DW_AT_location (0x00000000 28; CHECK-NEXT: {{0x[0-9a-f]+}}, [[ADDR1:0x[0-9a-f]+]]): DW_OP_constu 0x7b, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_constu 0x1c8, DW_OP_stack_value, DW_OP_piece 0x4 29; CHECK-NEXT: [[ADDR1]], [[ADDR2:0x[0-9a-f]+]]): DW_OP_piece 0x4, DW_OP_constu 0x1c8, DW_OP_stack_value, DW_OP_piece 0x4 30; CHECK-NEXT: [[ADDR2]], {{0x[0-9a-f]+}}): DW_OP_constu 0x315, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_constu 0x1c8, DW_OP_stack_value, DW_OP_piece 0x4) 31; CHECK-NEXT: DW_AT_name ("s") 32 33; Function Attrs: noinline nounwind uwtable 34define i32 @main() !dbg !7 { 35entry: 36 call void @llvm.dbg.value(metadata i32 123, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !18 37 call void @llvm.dbg.value(metadata i32 456, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !18 38 %call = tail call i32 @ext(i32 1), !dbg !19 39 %call1 = tail call i32 @ext(i32 2), !dbg !20 40 call void @llvm.dbg.value(metadata i32 undef, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !18 41 %call2 = tail call i32 @ext(i32 3), !dbg !21 42 call void @llvm.dbg.value(metadata i32 789, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !18 43 ret i32 456, !dbg !22 44} 45 46declare i32 @ext(i32) 47 48; Function Attrs: nounwind readnone speculatable 49declare void @llvm.dbg.value(metadata, metadata, metadata) #0 50 51attributes #0 = { nounwind readnone speculatable } 52 53!llvm.dbg.cu = !{!0} 54!llvm.module.flags = !{!3, !4} 55!llvm.ident = !{!6} 56 57!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) 58!1 = !DIFile(filename: "undef.c", directory: "/") 59!2 = !{} 60!3 = !{i32 2, !"Dwarf Version", i32 4} 61!4 = !{i32 2, !"Debug Info Version", i32 3} 62!6 = !{!"clang version 9.0.0"} 63!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11) 64!8 = !DISubroutineType(types: !9) 65!9 = !{!10} 66!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 67!11 = !{!12} 68!12 = !DILocalVariable(name: "s", scope: !7, file: !1, line: 6, type: !13) 69!13 = !DIDerivedType(tag: DW_TAG_typedef, name: "S", file: !1, line: 1, baseType: !14) 70!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !1, line: 1, size: 64, elements: !15) 71!15 = !{!16, !17} 72!16 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !14, file: !1, line: 1, baseType: !10, size: 32) 73!17 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !14, file: !1, line: 1, baseType: !10, size: 32, offset: 32) 74!18 = !DILocation(line: 6, scope: !7) 75!19 = !DILocation(line: 7, scope: !7) 76!20 = !DILocation(line: 8, scope: !7) 77!21 = !DILocation(line: 9, scope: !7) 78!22 = !DILocation(line: 11, scope: !7) 79