blob: 62d88ca733b217f17e0ab31376df7b74e0683baf [file] [log] [blame]
Manman Rened696c32013-07-24 22:23:00 +00001; RUN: llc -mtriple=x86_64-pc-linux-gnu %s -o %t -filetype=obj
Eli Benderskye6abe832013-01-25 21:44:53 +00002; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
James Molloy0ceb8ca2011-09-26 17:40:42 +00003
4; ModuleID = 'test.c'
5
Nick Lewyckyd59c0ca2011-10-27 06:44:11 +00006@GLB = common global i32 0, align 4
James Molloy0ceb8ca2011-09-26 17:40:42 +00007
Peter Collingbourned4bff302015-11-05 22:03:56 +00008define i32 @f() nounwind !dbg !5 {
Nick Lewyckyd59c0ca2011-10-27 06:44:11 +00009 %LOC = alloca i32, align 4
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000010 call void @llvm.dbg.declare(metadata i32* %LOC, metadata !15, metadata !DIExpression()), !dbg !17
David Blaikiea79ac142015-02-27 21:17:42 +000011 %1 = load i32, i32* @GLB, align 4, !dbg !18
Nick Lewyckyd59c0ca2011-10-27 06:44:11 +000012 store i32 %1, i32* %LOC, align 4, !dbg !18
David Blaikiea79ac142015-02-27 21:17:42 +000013 %2 = load i32, i32* @GLB, align 4, !dbg !19
James Molloy0ceb8ca2011-09-26 17:40:42 +000014 ret i32 %2, !dbg !19
15}
16
Adrian Prantl87b7eb92014-10-01 18:55:02 +000017declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
James Molloy0ceb8ca2011-09-26 17:40:42 +000018
19!llvm.dbg.cu = !{!0}
Manman Ren409558f2013-11-22 21:49:45 +000020!llvm.module.flags = !{!21}
James Molloy0ceb8ca2011-09-26 17:40:42 +000021
Adrian Prantl75819ae2016-04-15 15:57:41 +000022!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 Smithbe7ea192014-12-15 19:07:53 +000023!1 = !{}
Adrian Prantl75819ae2016-04-15 15:57:41 +000024!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 Smitha9308c42015-04-29 16:38:44 +000025!6 = !DIFile(filename: "test.c", directory: "/work/llvm/vanilla/test/DebugInfo")
26!7 = !DISubroutineType(types: !8)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000027!8 = !{!9}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000028!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000029!12 = !{!14}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000030!14 = !DIGlobalVariable(name: "GLB", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, variable: i32* @GLB)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000031!15 = !DILocalVariable(name: "LOC", line: 4, scope: !16, file: !6, type: !9)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000032!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 Molloy0ceb8ca2011-09-26 17:40:42 +000037
Manman Renf6b936b2013-10-29 05:49:41 +000038; CHECK: DW_TAG_variable
David Blaikie04ed1d12014-06-13 21:52:33 +000039; 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 Riss220fa482014-09-22 16:17:32 +000042; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
David Blaikie04ed1d12014-06-13 21:52:33 +000043; CHECK-NOT: DW_TAG
Frederic Riss0982e692014-09-05 07:21:50 +000044; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
James Molloy0ceb8ca2011-09-26 17:40:42 +000045
Manman Renf6b936b2013-10-29 05:49:41 +000046; CHECK: DW_TAG_variable
David Blaikie04ed1d12014-06-13 21:52:33 +000047; 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 Riss220fa482014-09-22 16:17:32 +000050; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
David Blaikie04ed1d12014-06-13 21:52:33 +000051; CHECK-NOT: DW_TAG
Frederic Riss0982e692014-09-05 07:21:50 +000052; CHECK: DW_AT_decl_line [DW_FORM_data1] (4)
Eric Christopherd6152aa2012-12-27 02:13:55 +000053
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000054!21 = !{i32 1, !"Debug Info Version", i32 3}