Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 1 | ; RUN: llc -filetype=obj -o %t.o %s |
Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 2 | ; RUN: llvm-dwarfdump -v %t.o | FileCheck %s |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 3 | |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 4 | ; Testcase generated using 'clang -g -O2 -S -emit-llvm' from the following: |
Duncan P. N. Exon Smith | a09bcd0 | 2015-04-17 00:37:53 +0000 | [diff] [blame] | 5 | ;; void sink(void); |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 6 | ;; static __attribute__((always_inline)) void bar(int a) { sink(); } |
Duncan P. N. Exon Smith | a09bcd0 | 2015-04-17 00:37:53 +0000 | [diff] [blame] | 7 | ;; void foo(void) { |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 8 | ;; bar(0); |
| 9 | ;; bar(0); |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 10 | ;; } |
| 11 | |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 12 | ; Check that we have formal parameters for 'a' in both inlined subroutines. |
Adrian Prantl | 274bcbc | 2017-06-16 22:40:04 +0000 | [diff] [blame] | 13 | ; CHECK: .debug_info |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 14 | ; CHECK: DW_TAG_inlined_subroutine |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 15 | ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar" |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 16 | ; CHECK: DW_TAG_formal_parameter |
| 17 | ; CHECK-NEXT: DW_AT_const_value |
| 18 | ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a" |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 19 | ; CHECK: DW_TAG_inlined_subroutine |
| 20 | ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar" |
| 21 | ; CHECK: DW_TAG_formal_parameter |
OCHyams | 57d8aca | 2020-08-27 09:40:53 +0100 | [diff] [blame] | 22 | ; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata] (0) |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 23 | ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a" |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 24 | |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 25 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 26 | target triple = "x86_64-apple-darwin" |
| 27 | |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 28 | ; Function Attrs: nounwind ssp uwtable |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 29 | define void @foo() #0 !dbg !4 { |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 30 | entry: |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 31 | tail call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !17) #3, !dbg !18 |
Duncan P. N. Exon Smith | a09bcd0 | 2015-04-17 00:37:53 +0000 | [diff] [blame] | 32 | tail call void @sink() #3, !dbg !20 |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 33 | tail call void @llvm.dbg.value(metadata i32 0, metadata !12, metadata !17) #3, !dbg !21 |
Duncan P. N. Exon Smith | a09bcd0 | 2015-04-17 00:37:53 +0000 | [diff] [blame] | 34 | tail call void @sink() #3, !dbg !23 |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 35 | ret void, !dbg !24 |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Adrian Prantl | 274bcbc | 2017-06-16 22:40:04 +0000 | [diff] [blame] | 38 | declare void @sink() |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 39 | |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 40 | ; Function Attrs: nounwind readnone |
Adrian Prantl | abe0475 | 2017-07-28 20:21:02 +0000 | [diff] [blame] | 41 | declare void @llvm.dbg.value(metadata, metadata, metadata) #2 |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 42 | |
Adrian Prantl | 274bcbc | 2017-06-16 22:40:04 +0000 | [diff] [blame] | 43 | attributes #0 = { nounwind ssp uwtable } |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 44 | attributes #2 = { nounwind readnone } |
| 45 | attributes #3 = { nounwind } |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 46 | |
| 47 | !llvm.dbg.cu = !{!0} |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 48 | !llvm.module.flags = !{!13, !14, !15} |
| 49 | !llvm.ident = !{!16} |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 50 | |
Adrian Prantl | 75819aed | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 51 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 52 | !1 = !DIFile(filename: "t.c", directory: "/path/to/dir") |
Duncan P. N. Exon Smith | 7bb480d | 2015-04-16 22:27:54 +0000 | [diff] [blame] | 53 | !2 = !{} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 54 | !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 55 | !5 = !DISubroutineType(types: !6) |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 56 | !6 = !{null} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 57 | !7 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 2, type: !8, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 58 | !8 = !DISubroutineType(types: !9) |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 59 | !9 = !{null, !10} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 60 | !10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 61 | !11 = !{!12} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 62 | !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10) |
Duncan P. N. Exon Smith | 05f53ae | 2015-04-17 00:18:46 +0000 | [diff] [blame] | 63 | !13 = !{i32 2, !"Dwarf Version", i32 2} |
| 64 | !14 = !{i32 2, !"Debug Info Version", i32 3} |
| 65 | !15 = !{i32 1, !"PIC Level", i32 2} |
| 66 | !16 = !{!"clang version 3.7.0 (trunk 235110) (llvm/trunk 235108)"} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 67 | !17 = !DIExpression() |
| 68 | !18 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !19) |
| 69 | !19 = distinct !DILocation(line: 4, column: 3, scope: !4) |
| 70 | !20 = !DILocation(line: 2, column: 57, scope: !7, inlinedAt: !19) |
| 71 | !21 = !DILocation(line: 2, column: 52, scope: !7, inlinedAt: !22) |
| 72 | !22 = distinct !DILocation(line: 5, column: 3, scope: !4) |
| 73 | !23 = !DILocation(line: 2, column: 57, scope: !7, inlinedAt: !22) |
| 74 | !24 = !DILocation(line: 6, column: 1, scope: !4) |