Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
4
5 ; RUN: llc -mtriple=x86_64-pc-linux-gnu %t.ll -o %t -filetype=obj
6 ; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s
7
8 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
9 target triple = "spir64-unknown-unknown"
10
11 ; ModuleID = 'test.c'
12
13 source_filename = "test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll"
14
15 @GLB = common global i32 0, align 4, !dbg !0
16
17 ; Function Attrs: nounwind
18 define i32 @f() #0 !dbg !8 {
19 %LOC = alloca i32, align 4
20 call void @llvm.dbg.declare(metadata i32* %LOC, metadata !11, metadata !13), !dbg !14
21 %1 = load i32, i32* @GLB, align 4, !dbg !15
22 store i32 %1, i32* %LOC, align 4, !dbg !15
23 %2 = load i32, i32* @GLB, align 4, !dbg !16
24 ret i32 %2, !dbg !16
25 }
26
27 ; Function Attrs: nounwind readnone
28 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
29
30 attributes #0 = { nounwind }
31 attributes #1 = { nounwind readnone }
32
33 !llvm.dbg.cu = !{!4}
34 !llvm.module.flags = !{!7}
35
36 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
37 !1 = !DIGlobalVariable(name: "GLB", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true)
38 !2 = !DIFile(filename: "test.c", directory: "/work/llvm/vanilla/test/DebugInfo")
39 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
40 !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)
41 !5 = !{}
42 !6 = !{!0}
43 !7 = !{i32 1, !"Debug Info Version", i32 3}
44 !8 = distinct !DISubprogram(name: "f", scope: !2, file: !2, line: 3, type: !9, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4)
45 !9 = !DISubroutineType(types: !10)
46 !10 = !{!3}
47 !11 = !DILocalVariable(name: "LOC", scope: !12, file: !2, line: 4, type: !3)
48 !12 = distinct !DILexicalBlock(scope: !8, file: !2, line: 3, column: 9)
49 !13 = !DIExpression()
50 !14 = !DILocation(line: 4, column: 9, scope: !12)
51 !15 = !DILocation(line: 4, column: 23, scope: !12)
52 !16 = !DILocation(line: 5, column: 5, scope: !12)
53
54 ; CHECK: DW_TAG_variable
55 ; CHECK-NOT: DW_TAG
56 ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "GLB")
57 ; CHECK-NOT: DW_TAG
58 ; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
59 ; CHECK-NOT: DW_TAG
60 ; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
61
62 ; CHECK: DW_TAG_variable
63 ; CHECK-NOT: DW_TAG
64 ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "LOC")
65 ; CHECK-NOT: DW_TAG
66 ; CHECK: DW_AT_decl_file [DW_FORM_data1] ("/work/llvm/vanilla/test/DebugInfo{{[/\\]}}test.c")
67 ; CHECK-NOT: DW_TAG
68 ; CHECK: DW_AT_decl_line [DW_FORM_data1] (4)
69