Manman Ren | ed696c3 | 2013-07-24 22:23:00 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=x86_64-pc-linux-gnu %s -o %t -filetype=obj |
Eli Bendersky | e6abe83 | 2013-01-25 21:44:53 +0000 | [diff] [blame] | 2 | ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s |
James Molloy | 0ceb8ca | 2011-09-26 17:40:42 +0000 | [diff] [blame] | 3 | |
| 4 | ; ModuleID = 'test.c' |
| 5 | |
Nick Lewycky | d59c0ca | 2011-10-27 06:44:11 +0000 | [diff] [blame] | 6 | @GLB = common global i32 0, align 4 |
James Molloy | 0ceb8ca | 2011-09-26 17:40:42 +0000 | [diff] [blame] | 7 | |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 8 | define i32 @f() nounwind !dbg !5 { |
Nick Lewycky | d59c0ca | 2011-10-27 06:44:11 +0000 | [diff] [blame] | 9 | %LOC = alloca i32, align 4 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 10 | call void @llvm.dbg.declare(metadata i32* %LOC, metadata !15, metadata !DIExpression()), !dbg !17 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 11 | %1 = load i32, i32* @GLB, align 4, !dbg !18 |
Nick Lewycky | d59c0ca | 2011-10-27 06:44:11 +0000 | [diff] [blame] | 12 | store i32 %1, i32* %LOC, align 4, !dbg !18 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 13 | %2 = load i32, i32* @GLB, align 4, !dbg !19 |
James Molloy | 0ceb8ca | 2011-09-26 17:40:42 +0000 | [diff] [blame] | 14 | ret i32 %2, !dbg !19 |
| 15 | } |
| 16 | |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 17 | declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
James Molloy | 0ceb8ca | 2011-09-26 17:40:42 +0000 | [diff] [blame] | 18 | |
| 19 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 20 | !llvm.module.flags = !{!21} |
James Molloy | 0ceb8ca | 2011-09-26 17:40:42 +0000 | [diff] [blame] | 21 | |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 22 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk)", isOptimized: false, emissionKind: FullDebug, file: !20, enums: !1, retainedTypes: !1, globals: !12, imports: !1) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 23 | !1 = !{} |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 24 | !5 = distinct !DISubprogram(name: "f", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !0, file: !6, scope: !6, type: !7) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 25 | !6 = !DIFile(filename: "test.c", directory: "/work/llvm/vanilla/test/DebugInfo") |
| 26 | !7 = !DISubroutineType(types: !8) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 27 | !8 = !{!9} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 28 | !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 29 | !12 = !{!14} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 30 | !14 = !DIGlobalVariable(name: "GLB", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, variable: i32* @GLB) |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 31 | !15 = !DILocalVariable(name: "LOC", line: 4, scope: !16, file: !6, type: !9) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 32 | !16 = distinct !DILexicalBlock(line: 3, column: 9, file: !20, scope: !5) |
| 33 | !17 = !DILocation(line: 4, column: 9, scope: !16) |
| 34 | !18 = !DILocation(line: 4, column: 23, scope: !16) |
| 35 | !19 = !DILocation(line: 5, column: 5, scope: !16) |
| 36 | !20 = !DIFile(filename: "test.c", directory: "/work/llvm/vanilla/test/DebugInfo") |
James Molloy | 0ceb8ca | 2011-09-26 17:40:42 +0000 | [diff] [blame] | 37 | |
Manman Ren | f6b936b | 2013-10-29 05:49:41 +0000 | [diff] [blame] | 38 | ; CHECK: DW_TAG_variable |
David Blaikie | 04ed1d1 | 2014-06-13 21:52:33 +0000 | [diff] [blame] | 39 | ; CHECK-NOT: DW_TAG |
| 40 | ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "GLB") |
| 41 | ; CHECK-NOT: DW_TAG |
Frederic Riss | 220fa48 | 2014-09-22 16:17:32 +0000 | [diff] [blame] | 42 | ; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c") |
David Blaikie | 04ed1d1 | 2014-06-13 21:52:33 +0000 | [diff] [blame] | 43 | ; CHECK-NOT: DW_TAG |
Frederic Riss | 0982e69 | 2014-09-05 07:21:50 +0000 | [diff] [blame] | 44 | ; CHECK: DW_AT_decl_line [DW_FORM_data1] (1) |
James Molloy | 0ceb8ca | 2011-09-26 17:40:42 +0000 | [diff] [blame] | 45 | |
Manman Ren | f6b936b | 2013-10-29 05:49:41 +0000 | [diff] [blame] | 46 | ; CHECK: DW_TAG_variable |
David Blaikie | 04ed1d1 | 2014-06-13 21:52:33 +0000 | [diff] [blame] | 47 | ; CHECK-NOT: DW_TAG |
| 48 | ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "LOC") |
| 49 | ; CHECK-NOT: DW_TAG |
Frederic Riss | 220fa48 | 2014-09-22 16:17:32 +0000 | [diff] [blame] | 50 | ; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c") |
David Blaikie | 04ed1d1 | 2014-06-13 21:52:33 +0000 | [diff] [blame] | 51 | ; CHECK-NOT: DW_TAG |
Frederic Riss | 0982e69 | 2014-09-05 07:21:50 +0000 | [diff] [blame] | 52 | ; CHECK: DW_AT_decl_line [DW_FORM_data1] (4) |
Eric Christopher | d6152aa | 2012-12-27 02:13:55 +0000 | [diff] [blame] | 53 | |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 54 | !21 = !{i32 1, !"Debug Info Version", i32 3} |