Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 1 | ; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 2 | ; |
| 3 | ; Checks that we're creating two ranges, one that terminates immediately |
| 4 | ; and one that spans the rest of the function. This isn't necessarily the |
| 5 | ; best thing to do here (and also not necessarily correct, since the first |
| 6 | ; one has a bit_piece), but it is what is currently being emitted, any |
| 7 | ; change here needs to be intentional, so the test is very specific. |
| 8 | ; |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 9 | ; CHECK: DW_TAG_inlined_subroutine |
| 10 | ; CHECK: DW_TAG_variable |
| 11 | ; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}} |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame^] | 12 | ; CHECK: [0x00000004, 0x00000004): DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x8 |
| 13 | ; CHECK: [0x00000004, 0x00000014): DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4) |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 14 | |
| 15 | ; Created form the following test case (PR26163) with |
| 16 | ; clang -cc1 -triple armv4t--freebsd11.0-gnueabi -emit-obj -debug-info-kind=standalone -O2 -x c test.c |
| 17 | ; |
| 18 | ; typedef unsigned int size_t; |
| 19 | ; struct timeval { |
| 20 | ; long long tv_sec; |
| 21 | ; int tv_usec; |
| 22 | ; }; |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame^] | 23 | ; |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 24 | ; void *memset(void *, int, size_t); |
| 25 | ; void foo(void); |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame^] | 26 | ; |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 27 | ; static void |
| 28 | ; bar(int value) |
| 29 | ; { |
| 30 | ; struct timeval lifetime; |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame^] | 31 | ; |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 32 | ; memset(&lifetime, 0, sizeof(struct timeval)); |
| 33 | ; lifetime.tv_sec = value; |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame^] | 34 | ; |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 35 | ; foo(); |
| 36 | ; } |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame^] | 37 | ; |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 38 | ; int |
| 39 | ; parse_config_file(void) |
| 40 | ; { |
| 41 | ; int value; |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame^] | 42 | ; |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 43 | ; bar(value); |
| 44 | ; return (0); |
| 45 | ; } |
| 46 | |
| 47 | target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" |
| 48 | target triple = "armv4t--freebsd11.0-gnueabi" |
| 49 | |
| 50 | %struct.timeval = type { i64, i32 } |
| 51 | |
| 52 | declare void @llvm.dbg.declare(metadata, metadata, metadata) |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 53 | declare void @llvm.dbg.value(metadata, metadata, metadata) |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 54 | |
| 55 | declare void @foo() |
| 56 | |
| 57 | define i32 @parse_config_file() !dbg !4 { |
| 58 | entry: |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 59 | tail call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !26), !dbg !27 |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 60 | tail call void @llvm.dbg.declare(metadata %struct.timeval* undef, metadata !16, metadata !26), !dbg !29 |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 61 | tail call void @llvm.dbg.value(metadata i64 0, metadata !16, metadata !30), !dbg !29 |
| 62 | tail call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !31), !dbg !29 |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 63 | tail call void @foo() #3, !dbg !32 |
| 64 | ret i32 0, !dbg !33 |
| 65 | } |
| 66 | |
| 67 | |
| 68 | !llvm.dbg.cu = !{!0} |
| 69 | !llvm.module.flags = !{!22, !23, !24} |
| 70 | !llvm.ident = !{!25} |
| 71 | |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 72 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257891)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 73 | !1 = !DIFile(filename: "<stdin>", directory: "/home/ubuntu/bugs") |
| 74 | !2 = !{} |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 75 | !4 = distinct !DISubprogram(name: "parse_config_file", scope: !5, file: !5, line: 22, type: !6, isLocal: false, isDefinition: true, scopeLine: 23, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !9) |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 76 | !5 = !DIFile(filename: "test.c", directory: "/home/ubuntu/bugs") |
| 77 | !6 = !DISubroutineType(types: !7) |
| 78 | !7 = !{!8} |
| 79 | !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 80 | !9 = !{!10} |
| 81 | !10 = !DILocalVariable(name: "value", scope: !4, file: !5, line: 24, type: !8) |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 82 | !11 = distinct !DISubprogram(name: "bar", scope: !5, file: !5, line: 11, type: !12, isLocal: true, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !14) |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 83 | !12 = !DISubroutineType(types: !13) |
| 84 | !13 = !{null, !8} |
| 85 | !14 = !{!15, !16} |
| 86 | !15 = !DILocalVariable(name: "value", arg: 1, scope: !11, file: !5, line: 11, type: !8) |
| 87 | !16 = !DILocalVariable(name: "lifetime", scope: !11, file: !5, line: 13, type: !17) |
| 88 | !17 = !DICompositeType(tag: DW_TAG_structure_type, name: "timeval", file: !5, line: 2, size: 128, align: 64, elements: !18) |
| 89 | !18 = !{!19, !21} |
| 90 | !19 = !DIDerivedType(tag: DW_TAG_member, name: "tv_sec", scope: !17, file: !5, line: 3, baseType: !20, size: 64, align: 64) |
| 91 | !20 = !DIBasicType(name: "long long int", size: 64, align: 64, encoding: DW_ATE_signed) |
| 92 | !21 = !DIDerivedType(tag: DW_TAG_member, name: "tv_usec", scope: !17, file: !5, line: 4, baseType: !8, size: 32, align: 32, offset: 64) |
| 93 | !22 = !{i32 2, !"Debug Info Version", i32 3} |
| 94 | !23 = !{i32 1, !"wchar_size", i32 4} |
| 95 | !24 = !{i32 1, !"min_enum_size", i32 4} |
| 96 | !25 = !{!"clang version 3.9.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257891)"} |
| 97 | !26 = !DIExpression() |
| 98 | !27 = !DILocation(line: 11, scope: !11, inlinedAt: !28) |
| 99 | !28 = distinct !DILocation(line: 26, scope: !4) |
| 100 | !29 = !DILocation(line: 13, scope: !11, inlinedAt: !28) |
Adrian Prantl | 941fa75 | 2016-12-05 18:04:47 +0000 | [diff] [blame] | 101 | !30 = !DIExpression(DW_OP_LLVM_fragment, 0, 64) |
| 102 | !31 = !DIExpression(DW_OP_LLVM_fragment, 0, 32) |
Keno Fischer | bc0cb11 | 2016-01-16 01:15:32 +0000 | [diff] [blame] | 103 | !32 = !DILocation(line: 18, scope: !11, inlinedAt: !28) |
| 104 | !33 = !DILocation(line: 27, scope: !4) |