Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/Generic/dead-argument-order.ll

raw
1 ; REQUIRES: object-emission
2
3 ; RUN: llvm-as < %s -o %t.bc
4 ; RUN: llvm-spirv %t.bc -o %t.spv
5 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
6
7 ; RUN: llc -mtriple=%triple -O0 -filetype=obj < %t.ll | llvm-dwarfdump -v -debug-info - | FileCheck %s
8
9 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"
10 target triple = "spir64-unknown-unknown"
11
12 ; Built from the following source with clang -O1
13 ; struct S { int i; };
14 ; int function(struct S s, int i) { return s.i + i; }
15
16 ; Due to the X86_64 ABI, 's' is passed in registers and once optimized, the
17 ; entirety of 's' is never reconstituted, since only the int is required, and
18 ; thus the variable's location is unknown/dead to debug info.
19
20 ; Future/current work should enable us to describe partial variables, which, in
21 ; this case, happens to be the entire variable.
22
23 ; CHECK: DW_TAG_subprogram
24 ; CHECK-NOT: DW_TAG
25 ; CHECK: DW_AT_name {{.*}} "function"
26 ; CHECK-NOT: {{DW_TAG|NULL}}
27 ; CHECK: DW_TAG_formal_parameter
28 ; CHECK-NOT: DW_TAG
29 ; CHECK: DW_AT_name {{.*}} "s"
30 ; CHECK-NOT: DW_TAG
31 ; FIXME: Even though 's' is never reconstituted into a struct, the one member
32 ; variable is still live and used, and so we should be able to describe 's's
33 ; location as the location of that int.
34 ; CHECK-NOT: DW_AT_location
35 ; CHECK-NOT: {{DW_TAG|NULL}}
36 ; CHECK: DW_TAG_formal_parameter
37 ; CHECK-NOT: DW_TAG
38 ; CHECK: DW_AT_location
39 ; CHECK-NOT: DW_TAG
40 ; CHECK: DW_AT_name {{.*}} "i"
41
42
43 %struct.S = type { i32 }
44
45 ; Function Attrs: nounwind readnone uwtable
46 define i32 @_Z8function1Si(i32 %s.coerce, i32 %i) #0 !dbg !9 {
47 entry:
48 tail call void @llvm.dbg.declare(metadata %struct.S* undef, metadata !14, metadata !DIExpression()), !dbg !20
49 tail call void @llvm.dbg.value(metadata i32 %i, metadata !15, metadata !DIExpression()), !dbg !20
50 %add = add nsw i32 %i, %s.coerce, !dbg !20
51 ret i32 %add, !dbg !20
52 }
53
54 ; Function Attrs: nounwind readnone
55 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
56
57 ; Function Attrs: nounwind readnone
58 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
59
60 attributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
61 attributes #1 = { nounwind readnone }
62
63 !llvm.dbg.cu = !{!0}
64 !llvm.module.flags = !{!16, !17}
65 !llvm.ident = !{!18}
66
67 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
68 !1 = !DIFile(filename: "dead-argument-order.cpp", directory: "/tmp/dbginfo")
69 !2 = !{}
70 !3 = !{!4}
71 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 1, size: 32, align: 32, file: !1, elements: !5, identifier: "_ZTS1S")
72 !5 = !{!6}
73 !6 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 1, size: 32, align: 32, file: !1, scope: !4, baseType: !7)
74 !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
75 !9 = distinct !DISubprogram(name: "function", linkageName: "_Z8function1Si", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 2, file: !1, scope: !10, type: !11, retainedNodes: !13)
76 !10 = !DIFile(filename: "dead-argument-order.cpp", directory: "/tmp/dbginfo")
77 !11 = !DISubroutineType(types: !12)
78 !12 = !{!7, !4, !7}
79 !13 = !{!14, !15}
80 !14 = !DILocalVariable(name: "s", line: 2, arg: 1, scope: !9, file: !10, type: !4)
81 !15 = !DILocalVariable(name: "i", line: 2, arg: 2, scope: !9, file: !10, type: !7)
82 !16 = !{i32 2, !"Dwarf Version", i32 4}
83 !17 = !{i32 2, !"Debug Info Version", i32 3}
84 !18 = !{!"clang version 3.5.0 "}
85 !19 = !{%struct.S* undef}
86 !20 = !DILocation(line: 2, scope: !9)
87