Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll

raw
1 ; REQUIRES: object-emission
2 ; This test is failing for powerpc64, because a location list for the
3 ; variable 'c' is not generated at all. Temporary marking this test as XFAIL
4 ; for powerpc, until PR21881 is fixed.
5 ; XFAIL: powerpc64
6
7 ; RUN: llvm-as < %s -o %t.bc
8 ; RUN: llvm-spirv %t.bc -o %t.spv
9 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
10
11 ; RUN: llc -mtriple=%triple -O2 -dwarf-version 2 -filetype=obj < %t.ll | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF23
12 ; RUN: llc -mtriple=%triple -O2 -dwarf-version 3 -filetype=obj < %t.ll | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF23
13 ; RUN: llc -mtriple=%triple -O2 -dwarf-version 4 -filetype=obj < %t.ll | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF4
14
15 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"
16 target triple = "spir64-unknown-unknown"
17
18 ; This is a test for PR21176.
19 ; DW_OP_const <const> doesn't describe a constant value, but a value at a constant address.
20 ; The proper way to describe a constant value is DW_OP_constu <const>, DW_OP_stack_value.
21 ; For values < 32 we emit the canonical DW_OP_lit<const>.
22
23 ; Generated with clang -S -emit-llvm -g -O2 test.cpp
24
25 ; extern int func();
26 ;
27 ; int main()
28 ; {
29 ; volatile int c = 13;
30 ; c = func();
31 ; return c;
32 ; }
33
34 ; CHECK: DW_TAG_variable
35 ; CHECK: DW_AT_location
36 ; CHECK-NOT: DW_AT
37 ; DWARF23: DW_OP_lit13{{$}}
38 ; DWARF4: DW_OP_lit13, DW_OP_stack_value{{$}}
39
40 ; Function Attrs: uwtable
41 define i32 @main() #0 !dbg !4 {
42 entry:
43 %c = alloca i32, align 4
44 tail call void @llvm.dbg.value(metadata i32 13, metadata !10, metadata !16), !dbg !17
45 store volatile i32 13, i32* %c, align 4, !dbg !18
46 %call = tail call i32 @_Z4funcv(), !dbg !19
47 tail call void @llvm.dbg.value(metadata i32 %call, metadata !10, metadata !16), !dbg !17
48 store volatile i32 %call, i32* %c, align 4, !dbg !19
49 tail call void @llvm.dbg.value(metadata i32* %c, metadata !10, metadata !21), !dbg !17
50 %c.0.c.0. = load volatile i32, i32* %c, align 4, !dbg !20
51 ret i32 %c.0.c.0., !dbg !20
52 }
53
54 declare i32 @_Z4funcv() #1
55
56 ; Function Attrs: nounwind readnone
57 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
58
59 attributes #0 = { 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" }
60 attributes #1 = { "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 #2 = { nounwind readnone }
62
63 !llvm.dbg.cu = !{!0}
64 !llvm.module.flags = !{!12, !13}
65 !llvm.ident = !{!14}
66
67 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 223522)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
68 !1 = !DIFile(filename: "test.cpp", directory: "/home/kromanova/ngh/ToT_latest/llvm/test/DebugInfo")
69 !2 = !{}
70 !4 = distinct !DISubprogram(name: "main", line: 3, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 4, file: !1, scope: !5, type: !6, retainedNodes: !9)
71 !5 = !DIFile(filename: "test.cpp", directory: "/home/kromanova/ngh/ToT_latest/llvm/test/DebugInfo")
72 !6 = !DISubroutineType(types: !7)
73 !7 = !{!8}
74 !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
75 !9 = !{!10}
76 !10 = !DILocalVariable(name: "c", line: 5, scope: !4, file: !5, type: !11)
77 !11 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !8)
78 !12 = !{i32 2, !"Dwarf Version", i32 2}
79 !13 = !{i32 2, !"Debug Info Version", i32 3}
80 !14 = !{!"clang version 3.6.0 (trunk 223522)"}
81 !15 = !{i32 13}
82 !16 = !DIExpression()
83 !17 = !DILocation(line: 5, column: 16, scope: !4)
84 !18 = !DILocation(line: 5, column: 3, scope: !4)
85 !19 = !DILocation(line: 6, column: 7, scope: !4)
86 !20 = !DILocation(line: 7, column: 3, scope: !4)
87 !21 = !DIExpression(DW_OP_deref)
88