blob: 1252f2cb32e3397a63fc0b6b7755cea30341efaa [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
8define i32 @f() nounwind {
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
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000022!0 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk)", isOptimized: false, emissionKind: 0, file: !20, enums: !1, retainedTypes: !1, subprograms: !3, globals: !12, imports: !1)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000023!1 = !{}
24!3 = !{!5}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000025!5 = !DISubprogram(name: "f", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !6, scope: !6, type: !7, function: i32 ()* @f)
26!6 = !DIFile(filename: "test.c", directory: "/work/llvm/vanilla/test/DebugInfo")
27!7 = !DISubroutineType(types: !8)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000028!8 = !{!9}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000029!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 +000030!12 = !{!14}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000031!14 = !DIGlobalVariable(name: "GLB", line: 1, isLocal: false, isDefinition: true, scope: null, file: !6, type: !9, variable: i32* @GLB)
32!15 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "LOC", line: 4, scope: !16, file: !6, type: !9)
33!16 = distinct !DILexicalBlock(line: 3, column: 9, file: !20, scope: !5)
34!17 = !DILocation(line: 4, column: 9, scope: !16)
35!18 = !DILocation(line: 4, column: 23, scope: !16)
36!19 = !DILocation(line: 5, column: 5, scope: !16)
37!20 = !DIFile(filename: "test.c", directory: "/work/llvm/vanilla/test/DebugInfo")
James Molloy0ceb8ca2011-09-26 17:40:42 +000038
Manman Renf6b936b2013-10-29 05:49:41 +000039; CHECK: DW_TAG_variable
David Blaikie04ed1d12014-06-13 21:52:33 +000040; CHECK-NOT: DW_TAG
41; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "GLB")
42; CHECK-NOT: DW_TAG
Frederic Riss220fa482014-09-22 16:17:32 +000043; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
David Blaikie04ed1d12014-06-13 21:52:33 +000044; CHECK-NOT: DW_TAG
Frederic Riss0982e692014-09-05 07:21:50 +000045; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
James Molloy0ceb8ca2011-09-26 17:40:42 +000046
Manman Renf6b936b2013-10-29 05:49:41 +000047; CHECK: DW_TAG_variable
David Blaikie04ed1d12014-06-13 21:52:33 +000048; CHECK-NOT: DW_TAG
49; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "LOC")
50; CHECK-NOT: DW_TAG
Frederic Riss220fa482014-09-22 16:17:32 +000051; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
David Blaikie04ed1d12014-06-13 21:52:33 +000052; CHECK-NOT: DW_TAG
Frederic Riss0982e692014-09-05 07:21:50 +000053; CHECK: DW_AT_decl_line [DW_FORM_data1] (4)
Eric Christopherd6152aa2012-12-27 02:13:55 +000054
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000055!21 = !{i32 1, !"Debug Info Version", i32 3}