| 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=%triple -O0 < %t.ll | grep AT_decl_file | grep 2 |
| 6 |
|
| 7 |
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" |
| 8 |
target triple = "spir64-unknown-unknown" |
| 9 |
; Here _ZN1S3fooEv is defined in header file identified as AT_decl_file no. 2 in debug info. |
| 10 |
%struct.S = type <{ i8 }> |
| 11 |
|
| 12 |
define i32 @_Z3barv() nounwind ssp !dbg !3 { |
| 13 |
entry: |
| 14 |
%retval = alloca i32 ; <i32*> [#uses=2] |
| 15 |
%0 = alloca i32 ; <i32*> [#uses=2] |
| 16 |
%s1 = alloca %struct.S ; <%struct.S*> [#uses=1] |
| 17 |
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] |
| 18 |
call void @llvm.dbg.declare(metadata %struct.S* %s1, metadata !0, metadata !DIExpression()), !dbg !16 |
| 19 |
%1 = call i32 @_ZN1S3fooEv(%struct.S* %s1) nounwind, !dbg !17 ; <i32> [#uses=1] |
| 20 |
store i32 %1, i32* %0, align 4, !dbg !17 |
| 21 |
%2 = load i32, i32* %0, align 4, !dbg !17 ; <i32> [#uses=1] |
| 22 |
store i32 %2, i32* %retval, align 4, !dbg !17 |
| 23 |
br label %return, !dbg !17 |
| 24 |
|
| 25 |
return: ; preds = %entry |
| 26 |
%retval1 = load i32, i32* %retval, !dbg !17 ; <i32> [#uses=1] |
| 27 |
ret i32 %retval1, !dbg !16 |
| 28 |
} |
| 29 |
|
| 30 |
define linkonce_odr i32 @_ZN1S3fooEv(%struct.S* %this) nounwind ssp align 2 !dbg !12 { |
| 31 |
entry: |
| 32 |
%this_addr = alloca %struct.S* ; <%struct.S**> [#uses=1] |
| 33 |
%retval = alloca i32 ; <i32*> [#uses=1] |
| 34 |
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] |
| 35 |
call void @llvm.dbg.declare(metadata %struct.S** %this_addr, metadata !18, metadata !DIExpression(DW_OP_deref)), !dbg !21 |
| 36 |
store %struct.S* %this, %struct.S** %this_addr |
| 37 |
br label %return, !dbg !21 |
| 38 |
|
| 39 |
return: ; preds = %entry |
| 40 |
%retval1 = load i32, i32* %retval, !dbg !21 ; <i32> [#uses=1] |
| 41 |
ret i32 %retval1, !dbg !22 |
| 42 |
} |
| 43 |
|
| 44 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
| 45 |
|
| 46 |
!llvm.dbg.cu = !{!5} |
| 47 |
!llvm.module.flags = !{!28} |
| 48 |
|
| 49 |
!0 = !DILocalVariable(name: "s1", line: 3, scope: !1, file: !4, type: !9) |
| 50 |
!1 = distinct !DILexicalBlock(line: 3, column: 0, file: !25, scope: !2) |
| 51 |
!2 = distinct !DILexicalBlock(line: 3, column: 0, file: !25, scope: !3) |
| 52 |
!3 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !5, scopeLine: 3, file: !25, scope: !4, type: !6) |
| 53 |
!4 = !DIFile(filename: "one.cc", directory: "/tmp/") |
| 54 |
!5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: FullDebug, file: !25, enums: !27, retainedTypes: !27, imports: null) |
| 55 |
!6 = !DISubroutineType(types: !7) |
| 56 |
!7 = !{!8} |
| 57 |
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 58 |
!9 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 2, size: 8, align: 8, file: !26, scope: !4, elements: !11) |
| 59 |
!10 = !DIFile(filename: "one.h", directory: "/tmp/") |
| 60 |
!11 = !{!12} |
| 61 |
!12 = distinct !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !5, scopeLine: 3, file: !26, scope: !9, type: !13) |
| 62 |
!13 = !DISubroutineType(types: !14) |
| 63 |
!14 = !{!8, !15} |
| 64 |
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !25, scope: !4, baseType: !9) |
| 65 |
!16 = !DILocation(line: 3, scope: !1) |
| 66 |
!17 = !DILocation(line: 3, scope: !3) |
| 67 |
; Modified from being a pointer, to make this testcase independent of target pointer size |
| 68 |
!18 = !DILocalVariable(name: "this", line: 3, arg: 1, scope: !12, file: !10, type: !9) |
| 69 |
!19 = !DIDerivedType(tag: DW_TAG_const_type, size: 64, align: 64, flags: DIFlagArtificial, file: !25, scope: !4, baseType: !20) |
| 70 |
!20 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !25, scope: !4, baseType: !9) |
| 71 |
!21 = !DILocation(line: 3, scope: !12) |
| 72 |
!22 = !DILocation(line: 3, scope: !23) |
| 73 |
!23 = distinct !DILexicalBlock(line: 3, column: 0, file: !26, scope: !12) |
| 74 |
!25 = !DIFile(filename: "one.cc", directory: "/tmp/") |
| 75 |
!26 = !DIFile(filename: "one.h", directory: "/tmp/") |
| 76 |
!27 = !{} |
| 77 |
!28 = !{i32 1, !"Debug Info Version", i32 3} |