Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/lexical_block.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=x86_64-linux -O0 -filetype=obj < %t.ll \
8 ; RUN: | llvm-dwarfdump -v -debug-info - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-V4 %s
9 ; RUN: llc -mtriple=x86_64-linux -dwarf-version=3 -O0 -filetype=obj < %t.ll \
10 ; RUN: | llvm-dwarfdump -v -debug-info - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-V3 %s
11
12 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"
13 target triple = "spir64-unknown-unknown"
14
15 ; Check that we emit DW_TAG_lexical_block and that it has the right encoding
16 ; depending on the dwarf version.
17
18 ; CHECK: DW_TAG_lexical_block
19 ; CHECK-NOT: DW_TAG
20 ; CHECK: DW_AT_low_pc [DW_FORM_addr]
21 ; CHECK-NOT: DW_TAG
22 ; CHECK-V4: DW_AT_high_pc [DW_FORM_data4]
23 ; CHECK-V3: DW_AT_high_pc [DW_FORM_addr]
24
25 ; Test case produced from:
26 ; void b() {
27 ; if (int i = 3)
28 ; return;
29 ; }
30
31 ; Function Attrs: nounwind uwtable
32 define void @_Z1bv() #0 !dbg !4 {
33 entry:
34 %i = alloca i32, align 4
35 call void @llvm.dbg.declare(metadata i32* %i, metadata !11, metadata !DIExpression()), !dbg !14
36 store i32 3, i32* %i, align 4, !dbg !14
37 %0 = load i32, i32* %i, align 4, !dbg !14
38 %tobool = icmp ne i32 %0, 0, !dbg !14
39 br i1 %tobool, label %if.then, label %if.end, !dbg !14
40
41 if.then: ; preds = %entry
42 br label %if.end, !dbg !15
43
44 if.end: ; preds = %if.then, %entry
45 ret void, !dbg !16
46 }
47
48 ; Function Attrs: nounwind readnone
49 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
50
51 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
52 attributes #1 = { nounwind readnone }
53
54 !llvm.dbg.cu = !{!0}
55 !llvm.module.flags = !{!8, !9}
56 !llvm.ident = !{!10}
57
58 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
59 !1 = !DIFile(filename: "lexical_block.cpp", directory: "/tmp/dbginfo")
60 !2 = !{}
61 !4 = distinct !DISubprogram(name: "b", linkageName: "_Z1bv", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)
62 !5 = !DIFile(filename: "lexical_block.cpp", directory: "/tmp/dbginfo")
63 !6 = !DISubroutineType(types: !7)
64 !7 = !{null}
65 !8 = !{i32 2, !"Dwarf Version", i32 4}
66 !9 = !{i32 1, !"Debug Info Version", i32 3}
67 !10 = !{!"clang version 3.5.0 "}
68 !11 = !DILocalVariable(name: "i", line: 2, scope: !12, file: !5, type: !13)
69 !12 = distinct !DILexicalBlock(line: 2, column: 0, file: !1, scope: !4)
70 !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
71 !14 = !DILocation(line: 2, scope: !12)
72 !15 = !DILocation(line: 3, scope: !12)
73 !16 = !DILocation(line: 4, scope: !4)