1 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -O2 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
3 ; This reproducer is based on the following C code:
5 ; typedef struct { int a; int b; } S;
18 ; and was generated using -O2 -g -fno-inline.
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).
24 ; Verify that a location list entry describing s.b is started at the
25 ; non-overlapping undef debug value.
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")
33 ; Function Attrs: noinline nounwind uwtable
34 define i32 @main() !dbg !7 {
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
48 ; Function Attrs: nounwind readnone speculatable
49 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
51 attributes #0 = { nounwind readnone speculatable }
54 !llvm.module.flags = !{!3, !4}
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: "/")
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)
66 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
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)
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)