blob: 5ee98977f77d092b132e7018efdfe12adeabebed [file] [log] [blame]
Strahinja Petrovic29202f62017-09-21 10:04:02 +00001;RUN: opt -S -globalopt -f %s | FileCheck %s
2
3;CHECK: !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression(DW_OP_deref, DW_OP_constu, 111, DW_OP_mul, DW_OP_constu, 0, DW_OP_plus, DW_OP_stack_value))
4
5@foo = internal global i32 0, align 4, !dbg !0
6
7; Function Attrs: noinline nounwind optnone uwtable
8define void @set1() #0 !dbg !11 {
9entry:
10 store i32 111, i32* @foo, align 4, !dbg !14
11 ret void, !dbg !15
12}
13
14; Function Attrs: noinline nounwind optnone uwtable
15define void @set2() #0 !dbg !16 {
16entry:
17 store i32 0, i32* @foo, align 4, !dbg !17
18 ret void, !dbg !18
19}
20
21; Function Attrs: noinline nounwind optnone uwtable
22define i32 @get() #0 !dbg !19 {
23entry:
24 %0 = load i32, i32* @foo, align 4, !dbg !22
25 ret i32 %0, !dbg !23
26}
27
28attributes #0 = { noinline nounwind optnone uwtable }
29
30!llvm.dbg.cu = !{!2}
31!llvm.module.flags = !{!7, !8, !9}
32!llvm.ident = !{!10}
33
34!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
35!1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 1, type: !6, isLocal: true, isDefinition: true)
36!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
37!3 = !DIFile(filename: "integer-bool-dwarf.c", directory: "/")
38!4 = !{}
39!5 = !{!0}
40!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
41!7 = !{i32 2, !"Dwarf Version", i32 4}
42!8 = !{i32 2, !"Debug Info Version", i32 3}
43!9 = !{i32 1, !"wchar_size", i32 4}
44!10 = !{!"clang version 6.0.0 "}
45!11 = distinct !DISubprogram(name: "set1", scope: !3, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: false, unit: !2, variables: !4)
46!12 = !DISubroutineType(types: !13)
47!13 = !{null}
48!14 = !DILocation(line: 5, column: 7, scope: !11)
49!15 = !DILocation(line: 6, column: 1, scope: !11)
50!16 = distinct !DISubprogram(name: "set2", scope: !3, file: !3, line: 8, type: !12, isLocal: false, isDefinition: true, scopeLine: 9, isOptimized: false, unit: !2, variables: !4)
51!17 = !DILocation(line: 10, column: 7, scope: !16)
52!18 = !DILocation(line: 11, column: 1, scope: !16)
53!19 = distinct !DISubprogram(name: "get", scope: !3, file: !3, line: 13, type: !20, isLocal: false, isDefinition: true, scopeLine: 14, isOptimized: false, unit: !2, variables: !4)
54!20 = !DISubroutineType(types: !21)
55!21 = !{!6}
56!22 = !DILocation(line: 15, column: 10, scope: !19)
57!23 = !DILocation(line: 15, column: 3, scope: !19)