Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/live-debug-variables.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 -filetype=obj -o - %t.ll -experimental-debug-variable-locations=false | llvm-dwarfdump -name i4 - \
6 ; RUN: | FileCheck %s
7
8 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"
9 target triple = "spir64-unknown-unknown"
10
11 ; The test inlines the function F four times, with each inlined variable for
12 ; "i4" sharing the same virtual register. This means the live interval of the
13 ; register spans all of the inlined callsites, extending beyond the lexical
14 ; scope of each. Later during register allocation the live interval is split
15 ; into multiple intervals. Check that this does not generate multiple entries
16 ; within the debug location (see PR33730).
17 ;
18 ; Generated from:
19 ;
20 ; extern int foobar(int, int, int, int, int);
21 ;
22 ; int F(int i1, int i2, int i3, int i4, int i5) {
23 ; return foobar(i1, i2, i3, i4, i5);
24 ; }
25 ;
26 ; int foo(int a, int b, int c, int d, int e) {
27 ; return F(a,b,c,d,e) +
28 ; F(a,b,c,d,e) +
29 ; F(a,b,c,d,e) +
30 ; F(a,b,c,d,e);
31 ; }
32
33 ; Ignore the abstract entry.
34 ; CHECK: DW_TAG_formal_parameter
35 ; Check concrete entry has a single location.
36 ; CHECK: DW_TAG_formal_parameter
37 ; CHECK-NEXT: DW_AT_location (DW_OP_reg6 RBP)
38 ; CHECK-NEXT: DW_AT_abstract_origin
39 ; CHECK-NOT: DW_TAG_formal_parameter
40
41 declare i32 @foobar(i32, i32, i32, i32, i32)
42
43 define i32 @foo(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) !dbg !25 {
44 entry:
45 tail call void @llvm.dbg.value(metadata i32 %d, i64 0, metadata !15, metadata !17) #3, !dbg !41
46 %call.i = tail call i32 @foobar(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) #3, !dbg !43
47 %call.i21 = tail call i32 @foobar(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) #3, !dbg !50
48 %add = add nsw i32 %call.i21, %call.i, !dbg !51
49 %call.i22 = tail call i32 @foobar(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) #3, !dbg !58
50 %add3 = add nsw i32 %add, %call.i22, !dbg !59
51 %call.i23 = tail call i32 @foobar(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) #3, !dbg !66
52 %add5 = add nsw i32 %add3, %call.i23, !dbg !67
53 ret i32 %add5, !dbg !68
54 }
55
56 declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
57
58 !llvm.dbg.cu = !{!0}
59 !llvm.module.flags = !{!3, !4, !5}
60 !llvm.ident = !{!6}
61
62 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 (trunk 308976)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
63 !1 = !DIFile(filename: "foo.c", directory: "")
64 !2 = !{}
65 !3 = !{i32 2, !"Dwarf Version", i32 4}
66 !4 = !{i32 2, !"Debug Info Version", i32 3}
67 !5 = !{i32 1, !"wchar_size", i32 4}
68 !6 = !{!"clang version 6.0.0 (trunk 308976)"}
69 !7 = distinct !DISubprogram(name: "F", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11)
70 !8 = !DISubroutineType(types: !9)
71 !9 = !{!10, !10, !10, !10, !10, !10}
72 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
73 !11 = !{!15}
74 !15 = !DILocalVariable(name: "i4", arg: 4, scope: !7, file: !1, line: 3, type: !10)
75 !17 = !DIExpression()
76 !25 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 7, type: !8, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !26)
77 !26 = !{}
78 !38 = distinct !DILocation(line: 8, column: 10, scope: !25)
79 !41 = !DILocation(line: 3, column: 35, scope: !7, inlinedAt: !38)
80 !43 = !DILocation(line: 4, column: 10, scope: !7, inlinedAt: !38)
81 !45 = distinct !DILocation(line: 9, column: 10, scope: !25)
82 !50 = !DILocation(line: 4, column: 10, scope: !7, inlinedAt: !45)
83 !51 = !DILocation(line: 8, column: 23, scope: !25)
84 !53 = distinct !DILocation(line: 10, column: 10, scope: !25)
85 !58 = !DILocation(line: 4, column: 10, scope: !7, inlinedAt: !53)
86 !59 = !DILocation(line: 9, column: 23, scope: !25)
87 !61 = distinct !DILocation(line: 11, column: 10, scope: !25)
88 !66 = !DILocation(line: 4, column: 10, scope: !7, inlinedAt: !61)
89 !67 = !DILocation(line: 10, column: 23, scope: !25)
90 !68 = !DILocation(line: 8, column: 3, scope: !25)