1 ; RUN: llc -mtriple=x86_64-pc-linux-gnu %s -o %t -filetype=obj 2 ; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s 3 4 ; ModuleID = 'test.c' 5 6 source_filename = "test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll" 7 8 @GLB = common global i32 0, align 4, !dbg !0 9 10 ; Function Attrs: nounwind 11 define i32 @f() #0 !dbg !8 { 12 %LOC = alloca i32, align 4 13 call void @llvm.dbg.declare(metadata i32* %LOC, metadata !11, metadata !13), !dbg !14 14 %1 = load i32, i32* @GLB, align 4, !dbg !15 15 store i32 %1, i32* %LOC, align 4, !dbg !15 16 %2 = load i32, i32* @GLB, align 4, !dbg !16 17 ret i32 %2, !dbg !16 18 } 19 20 ; Function Attrs: nounwind readnone 21 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 22 23 attributes #0 = { nounwind } 24 attributes #1 = { nounwind readnone } 25 26 !llvm.dbg.cu = !{!4} 27 !llvm.module.flags = !{!7} 28 29 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 30 !1 = !DIGlobalVariable(name: "GLB", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true) 31 !2 = !DIFile(filename: "test.c", directory: "/work/llvm/vanilla/test/DebugInfo") 32 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 33 !4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 3.0 (trunk)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, imports: !5) 34 !5 = !{} 35 !6 = !{!0} 36 !7 = !{i32 1, !"Debug Info Version", i32 3} 37 !8 = distinct !DISubprogram(name: "f", scope: !2, file: !2, line: 3, type: !9, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4) 38 !9 = !DISubroutineType(types: !10) 39 !10 = !{!3} 40 !11 = !DILocalVariable(name: "LOC", scope: !12, file: !2, line: 4, type: !3) 41 !12 = distinct !DILexicalBlock(scope: !8, file: !2, line: 3, column: 9) 42 !13 = !DIExpression() 43 !14 = !DILocation(line: 4, column: 9, scope: !12) 44 !15 = !DILocation(line: 4, column: 23, scope: !12) 45 !16 = !DILocation(line: 5, column: 5, scope: !12) 46 47 ; CHECK: DW_TAG_variable 48 ; CHECK-NOT: DW_TAG 49 ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "GLB") 50 ; CHECK-NOT: DW_TAG 51 ; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c") 52 ; CHECK-NOT: DW_TAG 53 ; CHECK: DW_AT_decl_line [DW_FORM_data1] (1) 54 55 ; CHECK: DW_TAG_variable 56 ; CHECK-NOT: DW_TAG 57 ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "LOC") 58 ; CHECK-NOT: DW_TAG 59 ; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c") 60 ; CHECK-NOT: DW_TAG 61 ; CHECK: DW_AT_decl_line [DW_FORM_data1] (4) 62 63