2013-07-25 06:23:00 +08:00
; RUN: llc -mtriple=x86_64-pc-linux-gnu %s -o %t -filetype=obj
2013-01-26 05:44:53 +08:00
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
2011-09-27 01:40:42 +08:00
; ModuleID = 'test.c'
2016-12-22 08:45:21 +08:00
source_filename = "test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll"
2011-09-27 01:40:42 +08:00
2016-12-22 08:45:21 +08:00
@GLB = common global i32 0 , align 4 , !dbg !0
; Function Attrs: nounwind
define i32 @f ( ) #0 !dbg !8 {
2011-10-27 14:44:11 +08:00
%LOC = alloca i32 , align 4
2016-12-22 08:45:21 +08:00
call void @llvm.dbg.declare ( metadata i32 * %LOC , metadata !11 , metadata !13 ) , !dbg !14
%1 = load i32 , i32 * @GLB , align 4 , !dbg !15
store i32 %1 , i32 * %LOC , align 4 , !dbg !15
%2 = load i32 , i32 * @GLB , align 4 , !dbg !16
ret i32 %2 , !dbg !16
2011-09-27 01:40:42 +08:00
}
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare ( metadata , metadata , metadata ) #1
attributes #0 = { nounwind }
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = ! { !4 }
!llvm.module.flags = ! { !7 }
!0 = !DIGlobalVariableExpression ( var: !1 )
!1 = !DIGlobalVariable ( name: "GLB" , scope: null , file: !2 , line: 1 , type: !3 , isLocal: false , isDefinition: true )
!2 = !DIFile ( filename: "test.c" , directory: "/work/llvm/vanilla/test/DebugInfo" )
!3 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!4 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , file: !2 , producer: "clang version 3.0 (trunk)" , isOptimized: false , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !5 , retainedTypes: !5 , globals: !6 , imports: !5 )
!5 = ! { }
!6 = ! { !0 }
!7 = ! { i32 1 , !"Debug Info Version" , i32 3 }
!8 = distinct !DISubprogram ( name: "f" , scope: !2 , file: !2 , line: 3 , type: !9 , isLocal: false , isDefinition: true , virtualIndex: 6 , isOptimized: false , unit: !4 )
!9 = !DISubroutineType ( types: !10 )
!10 = ! { !3 }
!11 = !DILocalVariable ( name: "LOC" , scope: !12 , file: !2 , line: 4 , type: !3 )
!12 = distinct !DILexicalBlock ( scope: !8 , file: !2 , line: 3 , column: 9 )
!13 = !DIExpression ( )
!14 = !DILocation ( line: 4 , column: 9 , scope: !12 )
!15 = !DILocation ( line: 4 , column: 23 , scope: !12 )
!16 = !DILocation ( line: 5 , column: 5 , scope: !12 )
2011-09-27 01:40:42 +08:00
2013-10-29 13:49:41 +08:00
; CHECK: DW_TAG_variable
2014-06-14 05:52:33 +08:00
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "GLB")
; CHECK-NOT: DW_TAG
2014-09-23 00:17:32 +08:00
; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
2014-06-14 05:52:33 +08:00
; CHECK-NOT: DW_TAG
2014-09-05 15:21:50 +08:00
; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
2012-12-27 10:13:55 +08:00
2013-10-29 13:49:41 +08:00
; CHECK: DW_TAG_variable
2014-06-14 05:52:33 +08:00
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "LOC")
; CHECK-NOT: DW_TAG
2014-09-23 00:17:32 +08:00
; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
2014-06-14 05:52:33 +08:00
; CHECK-NOT: DW_TAG
2014-09-05 15:21:50 +08:00
; CHECK: DW_AT_decl_line [DW_FORM_data1] (4)
2011-09-27 01:40:42 +08:00