Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 1 | ; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - | FileCheck %s |
| 2 | ; |
| 3 | ; Created using clang -g -O3 from: |
| 4 | ; struct S0 { |
| 5 | ; short f0; |
| 6 | ; int f3; |
| 7 | ; } a; |
| 8 | ; void fn1(short p1) { |
| 9 | ; struct S0 b, c = {3}; |
| 10 | ; b.f3 = p1; |
| 11 | ; a = b = c; |
| 12 | ; } |
| 13 | ; |
| 14 | ; int main() { return 0; } |
| 15 | ; |
| 16 | ; This is similar to the bug in test/DebugInfo/ARM/PR26163.ll, except that there is an |
| 17 | ; extra non-overlapping range first. Thus, we make sure that the backend actually looks |
| 18 | ; at all expressions when determining whether to merge ranges, not just the first one. |
| 19 | ; AS in 26163, we expect two ranges (as opposed to one), the first one being zero sized |
| 20 | ; |
| 21 | ; |
Adrian Prantl | 981f03e | 2017-03-16 17:14:56 +0000 | [diff] [blame] | 22 | ; CHECK: Beginning address offset: 0x0000000000000004 |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 23 | ; CHECK: Ending address offset: 0x0000000000000004 |
Adrian Prantl | 8fafb8d | 2016-12-09 20:43:40 +0000 | [diff] [blame] | 24 | ; CHECK: Location description: 10 03 93 04 55 93 02 |
| 25 | ; constu 0x00000003, piece 0x00000004, rdi, piece 0x00000002 |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 26 | ; CHECK: Beginning address offset: 0x0000000000000004 |
| 27 | ; CHECK: Ending address offset: 0x0000000000000014 |
Adrian Prantl | 56527dc | 2016-11-02 16:12:16 +0000 | [diff] [blame] | 28 | ; CHECK: Location description: 10 03 93 04 10 00 |
| 29 | ; constu 0x00000003, piece 0x00000004, constu 0x00000000, piece 0x00000004 |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 30 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 31 | source_filename = "test/DebugInfo/X86/PR26148.ll" |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 32 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 33 | target triple = "x86_64-apple-macosx10.11.0" |
| 34 | |
| 35 | %struct.S0 = type { i16, i32 } |
| 36 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 37 | @a = common global %struct.S0 zeroinitializer, align 4, !dbg !0 |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 38 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 39 | ; Function Attrs: nounwind readnone |
| 40 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 41 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 42 | ; Function Attrs: nounwind readnone |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame^] | 43 | declare void @llvm.dbg.value(metadata, metadata, metadata) #0 |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 44 | ; The attributes are here to force the zero-sized range not to be at the start of |
| 45 | ; the function, which has special interpretation in DWARF. The fact that this happens |
| 46 | ; at all is probably an LLVM bug. |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 47 | |
| 48 | define void @fn1(i16 signext %p1) #1 !dbg !16 { |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 49 | entry: |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame^] | 50 | tail call void @llvm.dbg.value(metadata i16 %p1, metadata !20, metadata !23), !dbg !24 |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 51 | tail call void @llvm.dbg.declare(metadata %struct.S0* undef, metadata !21, metadata !23), !dbg !25 |
| 52 | tail call void @llvm.dbg.declare(metadata %struct.S0* undef, metadata !22, metadata !23), !dbg !26 |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame^] | 53 | tail call void @llvm.dbg.value(metadata i32 3, metadata !22, metadata !27), !dbg !26 |
| 54 | tail call void @llvm.dbg.value(metadata i32 0, metadata !22, metadata !28), !dbg !26 |
| 55 | tail call void @llvm.dbg.value(metadata i16 %p1, metadata !21, metadata !29), !dbg !25 |
| 56 | tail call void @llvm.dbg.value(metadata i32 3, metadata !21, metadata !27), !dbg !25 |
| 57 | tail call void @llvm.dbg.value(metadata i32 0, metadata !21, metadata !28), !dbg !25 |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 58 | store i32 3, i32* bitcast (%struct.S0* @a to i32*), align 4, !dbg !30 |
| 59 | store i32 0, i32* getelementptr inbounds (%struct.S0, %struct.S0* @a, i64 0, i32 1), align 4, !dbg !30 |
| 60 | ret void, !dbg !31 |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 61 | } |
| 62 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 63 | define i32 @main() !dbg !32 { |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 64 | entry: |
| 65 | ret i32 0, !dbg !35 |
| 66 | } |
| 67 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 68 | attributes #0 = { nounwind readnone } |
| 69 | attributes #1 = { "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" } |
Keno Fischer | 6c1e47a | 2016-02-03 21:13:33 +0000 | [diff] [blame] | 70 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 71 | !llvm.dbg.cu = !{!2} |
| 72 | !llvm.module.flags = !{!12, !13, !14} |
| 73 | !llvm.ident = !{!15} |
| 74 | |
| 75 | !0 = !DIGlobalVariableExpression(var: !1) |
| 76 | !1 = !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 4, type: !6, isLocal: false, isDefinition: true) |
| 77 | !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 3.9.0 (https://github.com/llvm-mirror/clang 8f258397c5afd7a708bd95770c718e81d08fb11a) (https://github.com/llvm-mirror/llvm 18481855bdfa1b4a424f81be8525db002671348d)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) |
| 78 | !3 = !DIFile(filename: "small.c", directory: "/Users/kfischer/Projects/clangbug") |
| 79 | !4 = !{} |
| 80 | !5 = !{!0} |
| 81 | !6 = !DICompositeType(tag: DW_TAG_structure_type, name: "S0", file: !3, line: 1, size: 64, align: 32, elements: !7) |
| 82 | !7 = !{!8, !10} |
| 83 | !8 = !DIDerivedType(tag: DW_TAG_member, name: "f0", scope: !6, file: !3, line: 2, baseType: !9, size: 16, align: 16) |
| 84 | !9 = !DIBasicType(name: "short", size: 16, align: 16, encoding: DW_ATE_signed) |
| 85 | !10 = !DIDerivedType(tag: DW_TAG_member, name: "f3", scope: !6, file: !3, line: 3, baseType: !11, size: 32, align: 32, offset: 32) |
| 86 | !11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 87 | !12 = !{i32 2, !"Dwarf Version", i32 2} |
| 88 | !13 = !{i32 2, !"Debug Info Version", i32 3} |
| 89 | !14 = !{i32 1, !"PIC Level", i32 2} |
| 90 | !15 = !{!"clang version 3.9.0 (https://github.com/llvm-mirror/clang 8f258397c5afd7a708bd95770c718e81d08fb11a) (https://github.com/llvm-mirror/llvm 18481855bdfa1b4a424f81be8525db002671348d)"} |
| 91 | !16 = distinct !DISubprogram(name: "fn1", scope: !3, file: !3, line: 5, type: !17, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !19) |
| 92 | !17 = !DISubroutineType(types: !18) |
| 93 | !18 = !{null, !9} |
| 94 | !19 = !{!20, !21, !22} |
| 95 | !20 = !DILocalVariable(name: "p1", arg: 1, scope: !16, file: !3, line: 5, type: !9) |
| 96 | !21 = !DILocalVariable(name: "b", scope: !16, file: !3, line: 6, type: !6) |
| 97 | !22 = !DILocalVariable(name: "c", scope: !16, file: !3, line: 6, type: !6) |
| 98 | !23 = !DIExpression() |
| 99 | !24 = !DILocation(line: 5, column: 16, scope: !16) |
| 100 | !25 = !DILocation(line: 6, column: 13, scope: !16) |
| 101 | !26 = !DILocation(line: 6, column: 16, scope: !16) |
| 102 | !27 = !DIExpression(DW_OP_LLVM_fragment, 0, 32) |
| 103 | !28 = !DIExpression(DW_OP_LLVM_fragment, 32, 32) |
| 104 | !29 = !DIExpression(DW_OP_LLVM_fragment, 32, 16) |
| 105 | !30 = !DILocation(line: 8, column: 9, scope: !16) |
| 106 | !31 = !DILocation(line: 9, column: 1, scope: !16) |
| 107 | !32 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 11, type: !33, isLocal: false, isDefinition: true, scopeLine: 11, isOptimized: true, unit: !2, variables: !4) |
| 108 | !33 = !DISubroutineType(types: !34) |
| 109 | !34 = !{!11} |
| 110 | !35 = !DILocation(line: 11, column: 14, scope: !32) |
| 111 | |