Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/Generic/debug-info-eis-option.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv --spirv-debug-info-version=legacy
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
4
5 ; RUN: llc -mtriple=%triple -stop-before=finalize-isel -pre-RA-sched=linearize < %t.ll -experimental-debug-variable-locations=false | FileCheck %s
6
7 ; RUN: llvm-spirv %t.spv -to-text -o - | FileCheck --check-prefix CHECK-SPIRV %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 ; CHECK-SPIRV: ExtInstImport [[Set:[0-9]+]] "SPIRV.debug"
12 ; CHECK-SPIRV: TypeVoid [[Void:[0-9]+]]
13 ; CHECK-SPIRV: ExtInst [[Void]] {{[0-9]+}} [[Set]] DebugValue
14
15 source_filename = "linear-dbg-value.ll"
16
17 ; Function Attrs: nounwind readonly uwtable
18 define i32 @foo(i32* nocapture readonly %a, i32 %N) local_unnamed_addr #0 !dbg !6 {
19 entry:
20 %cmp6 = icmp sgt i32 %N, 0, !dbg !11
21 br i1 %cmp6, label %for.body.preheader, label %for.cond.cleanup, !dbg !15
22
23 for.body.preheader: ; preds = %entry
24 %wide.trip.count = zext i32 %N to i64
25 br label %for.body, !dbg !17
26
27 for.cond.cleanup.loopexit: ; preds = %for.body
28 br label %for.cond.cleanup, !dbg !19
29
30 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
31 %x.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.cond.cleanup.loopexit ]
32 ret i32 %x.0.lcssa, !dbg !19
33
34 for.body: ; preds = %for.body, %for.body.preheader
35 ; CHECK: ![[X:[0-9]+]] = !DILocalVariable(name: "x",
36 ; CHECK-LABEL: bb.2.for.body:
37 ; CHECK: DBG_VALUE {{.*}} ![[X]], !DIExpression()
38 ; CHECK: DBG_VALUE {{.*}} ![[X]], !DIExpression()
39 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
40 %x.07 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
41 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv, !dbg !17
42 %0 = load i32, i32* %arrayidx, align 4, !dbg !17
43 %add = add nsw i32 %0, %x.07, !dbg !17
44 call void @llvm.dbg.value(metadata i32 %add, metadata !9, metadata !DIExpression()), !dbg !20
45 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !21
46 call void @llvm.dbg.value(metadata i32 %add, metadata !9, metadata !DIExpression()), !dbg !20
47 %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count, !dbg !11
48 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body, !dbg !15
49 }
50
51 ; Function Attrs: nounwind readnone speculatable
52 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
53
54 attributes #0 = { nounwind readonly uwtable }
55 attributes #1 = { nounwind readnone speculatable }
56
57 !llvm.dbg.cu = !{!0}
58 !llvm.module.flags = !{!3, !4}
59 !llvm.ident = !{!5}
60
61 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.1 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
62 !1 = !DIFile(filename: "foo.c", directory: "/tmp")
63 !2 = !{}
64 !3 = !{i32 2, !"Dwarf Version", i32 4}
65 !4 = !{i32 2, !"Debug Info Version", i32 3}
66 !5 = !{!"clang version 4.0.1 "}
67 !6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !8)
68 !7 = !DISubroutineType(types: !2)
69 !8 = !{!9}
70 !9 = !DILocalVariable(name: "x", scope: !6, file: !1, line: 3, type: !10)
71 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
72 !11 = !DILocation(line: 4, scope: !12)
73 !12 = !DILexicalBlockFile(scope: !13, file: !1, discriminator: 1)
74 !13 = distinct !DILexicalBlock(scope: !14, file: !1, line: 4, column: 3)
75 !14 = distinct !DILexicalBlock(scope: !6, file: !1, line: 4, column: 3)
76 !15 = !DILocation(line: 4, scope: !16)
77 !16 = !DILexicalBlockFile(scope: !14, file: !1, discriminator: 1)
78 !17 = !DILocation(line: 5, scope: !18)
79 !18 = distinct !DILexicalBlock(scope: !13, file: !1, line: 4, column: 31)
80 !19 = !DILocation(line: 7, scope: !6)
81 !20 = !DILocation(line: 3, scope: !6)
82 !21 = !DILocation(line: 4, scope: !22)
83 !22 = !DILexicalBlockFile(scope: !13, file: !1, discriminator: 3)