Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/debug-dead-local-var.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-linux-gnu %t.ll -filetype=obj -o %t
6 ; RUN: llvm-dwarfdump %t | FileCheck %s
7
8 ; Reconstruct this via clang and -O2.
9
10 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"
11 target triple = "spir64-unknown-unknown"
12 ; static void foo() {
13 ; struct X { int a; int b; } xyz;
14 ; }
15
16 ; int bar() {
17 ; foo();
18 ; return 1;
19 ; }
20
21 ; Check that we don't have the structure type for X since its scope has
22 ; been optimized away.
23 ; CHECK-NOT: DW_TAG_structure_type
24 ; CHECK: DW_TAG_subprogram
25 ; CHECK: DW_AT_name {{.*}}"bar"
26 ; CHECK-NOT: DW_TAG_structure_type
27
28 ; Function Attrs: nounwind readnone uwtable
29 define i32 @bar() #0 !dbg !4 {
30 entry:
31 ret i32 1, !dbg !21
32 }
33
34 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" }
35
36 !llvm.dbg.cu = !{!0}
37 !llvm.module.flags = !{!18, !19}
38 !llvm.ident = !{!20}
39
40 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 209255) (llvm/trunk 209253)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
41 !1 = !DIFile(filename: "debug-dead-local-var.c", directory: "/usr/local/google/home/echristo")
42 !2 = !{}
43 !4 = distinct !DISubprogram(name: "bar", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 11, file: !1, scope: !5, type: !6, retainedNodes: !2)
44 !5 = !DIFile(filename: "debug-dead-local-var.c", directory: "/usr/local/google/home/echristo")
45 !6 = !DISubroutineType(types: !7)
46 !7 = !{!8}
47 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
48 !9 = distinct !DISubprogram(name: "foo", line: 6, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 6, file: !1, scope: !5, type: !10, retainedNodes: !12)
49 !10 = !DISubroutineType(types: !11)
50 !11 = !{null}
51 !12 = !{!13}
52 !13 = !DILocalVariable(name: "xyz", line: 8, scope: !9, file: !5, type: !14)
53 !14 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", line: 8, size: 64, align: 32, file: !1, scope: !9, elements: !15)
54 !15 = !{!16, !17}
55 !16 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 8, size: 32, align: 32, file: !1, scope: !14, baseType: !8)
56 !17 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 8, size: 32, align: 32, offset: 32, file: !1, scope: !14, baseType: !8)
57 !18 = !{i32 2, !"Dwarf Version", i32 4}
58 !19 = !{i32 2, !"Debug Info Version", i32 3}
59 !20 = !{!"clang version 3.5.0 (trunk 209255) (llvm/trunk 209253)"}
60 !21 = !DILocation(line: 13, scope: !4)