Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/dbg-value-const-byref.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=%triple -O1 -filetype=obj -o - %t.ll | llvm-dwarfdump -all - | FileCheck %s
6 ; Generated with -O1 from:
7 ; int f1();
8 ; void f2(int*);
9 ; int f3(int);
10 ;
11 ; int foo() {
12 ; int i = 3;
13 ; f3(i);
14 ; i = 7;
15 ; i = f1();
16 ; f2(&i);
17 ; return 0;
18 ; }
19 ;
20 ; Test that we generate valid debug info for optimized code,
21 ; particularly variables that are described as constants and passed
22 ; by reference.
23 ; rdar://problem/14874886
24 ;
25 ; CHECK: .debug_info contents:
26 ; CHECK: DW_TAG_variable
27 ; CHECK-NOT: DW_TAG
28 ; CHECK: DW_AT_location {{.*}}({{.*}}
29 ; CHECK-NEXT: 0x{{0*.*}}, [[C1:0x.*]]): DW_OP_consts +3
30 ; CHECK-NEXT: [[C1]], [[C2:0x.*]]): DW_OP_consts +7
31 ; CHECK-NEXT: [[C2]], [[R1:0x.*]]): DW_OP_reg0 RAX
32 ; CHECK-NEXT: [[R1]], [[R2:0x.*]]): DW_OP_breg7 RSP+4)
33 ; CHECK-NOT: DW_TAG
34 ; CHECK: DW_AT_name{{.*}}"i"
35
36 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
37 target triple = "spir64-unknown-unknown"
38
39 ; Function Attrs: nounwind ssp uwtable
40 define i32 @foo() #0 !dbg !4 {
41 entry:
42 %i = alloca i32, align 4
43 call void @llvm.dbg.value(metadata i32 3, metadata !10, metadata !DIExpression()), !dbg !15
44 %call = call i32 @f3(i32 3) #3, !dbg !16
45 call void @llvm.dbg.value(metadata i32 7, metadata !10, metadata !DIExpression()), !dbg !18
46 %call1 = call i32 (...) @f1() #3, !dbg !19
47 call void @llvm.dbg.value(metadata i32 %call1, metadata !10, metadata !DIExpression()), !dbg !19
48 store i32 %call1, i32* %i, align 4, !dbg !19, !tbaa !20
49 call void @llvm.dbg.value(metadata i32* %i, metadata !10, metadata !DIExpression(DW_OP_deref)), !dbg !24
50 call void @f2(i32* %i) #3, !dbg !24
51 ret i32 0, !dbg !25
52 }
53
54 declare i32 @f3(i32)
55
56 declare i32 @f1(...)
57
58 declare void @f2(i32*)
59
60 ; Function Attrs: nounwind readnone
61 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
62
63 attributes #0 = { nounwind ssp uwtable }
64 attributes #2 = { nounwind readnone }
65 attributes #3 = { nounwind }
66
67 !llvm.dbg.cu = !{!0}
68 !llvm.module.flags = !{!11, !12}
69 !llvm.ident = !{!13}
70
71 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
72 !1 = !DIFile(filename: "dbg-value-const-byref.c", directory: "")
73 !2 = !{}
74 !4 = distinct !DISubprogram(name: "foo", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6, retainedNodes: !9)
75 !5 = !DIFile(filename: "dbg-value-const-byref.c", directory: "")
76 !6 = !DISubroutineType(types: !7)
77 !7 = !{!8}
78 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
79 !9 = !{!10}
80 !10 = !DILocalVariable(name: "i", line: 6, scope: !4, file: !5, type: !8)
81 !11 = !{i32 2, !"Dwarf Version", i32 2}
82 !12 = !{i32 1, !"Debug Info Version", i32 3}
83 !13 = !{!"clang version 3.5.0 "}
84 !14 = !{i32 3}
85 !15 = !DILocation(line: 6, scope: !4)
86 !16 = !DILocation(line: 7, scope: !4)
87 !17 = !{i32 7}
88 !18 = !DILocation(line: 8, scope: !4)
89 !19 = !DILocation(line: 9, scope: !4)
90 !20 = !{!21, !21, i64 0}
91 !21 = !{!"int", !22, i64 0}
92 !22 = !{!"omnipotent char", !23, i64 0}
93 !23 = !{!"Simple C/C++ TBAA"}
94 !24 = !DILocation(line: 10, scope: !4)
95 !25 = !DILocation(line: 11, scope: !4)