| 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=%triple -dwarf-version=2 -O0 -filetype=obj < %t.ll | llvm-dwarfdump -v -debug-info - | FileCheck --check-prefix=CHECK --check-prefix=V2 %s |
| 8 |
; RUN: llc -mtriple=%triple -dwarf-version=3 -O0 -filetype=obj < %t.ll | llvm-dwarfdump -v -debug-info - | FileCheck --check-prefix=CHECK --check-prefix=V3 %s |
| 9 |
|
| 10 |
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" |
| 11 |
target triple = "spir64-unknown-unknown" |
| 12 |
|
| 13 |
; CHECK: DW_AT_name {{.*}} "dst" |
| 14 |
; V2: DW_AT_type {{.*}} {[[PTR:0x.*]]} |
| 15 |
; V3: DW_AT_type {{.*}} {[[RESTRICT:0x.*]]} |
| 16 |
; V3: [[RESTRICT]]: {{.*}}DW_TAG_restrict_type |
| 17 |
; V3-NEXT: DW_AT_type {{.*}} {[[PTR:0x.*]]} |
| 18 |
; CHECK: [[PTR]]: {{.*}}DW_TAG_pointer_type |
| 19 |
; CHECK-NOT: DW_AT_type |
| 20 |
|
| 21 |
; Generated with clang from: |
| 22 |
; void foo(void* __restrict__ dst) { |
| 23 |
; } |
| 24 |
|
| 25 |
|
| 26 |
; Function Attrs: nounwind uwtable |
| 27 |
define void @_Z3fooPv(i8* noalias %dst) #0 !dbg !4 { |
| 28 |
entry: |
| 29 |
%dst.addr = alloca i8*, align 8 |
| 30 |
store i8* %dst, i8** %dst.addr, align 8 |
| 31 |
call void @llvm.dbg.declare(metadata i8** %dst.addr, metadata !13, metadata !DIExpression()), !dbg !14 |
| 32 |
ret void, !dbg !15 |
| 33 |
} |
| 34 |
|
| 35 |
; Function Attrs: nounwind readnone |
| 36 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| 37 |
|
| 38 |
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" } |
| 39 |
attributes #1 = { nounwind readnone } |
| 40 |
|
| 41 |
!llvm.dbg.cu = !{!0} |
| 42 |
!llvm.module.flags = !{!10, !11} |
| 43 |
!llvm.ident = !{!12} |
| 44 |
|
| 45 |
!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) |
| 46 |
!1 = !DIFile(filename: "restrict.c", directory: "/tmp/dbginfo") |
| 47 |
!2 = !{} |
| 48 |
!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooPv", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2) |
| 49 |
!5 = !DIFile(filename: "restrict.c", directory: "/tmp/dbginfo") |
| 50 |
!6 = !DISubroutineType(types: !7) |
| 51 |
!7 = !{null, !8} |
| 52 |
!8 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !9) |
| 53 |
!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null) |
| 54 |
!10 = !{i32 2, !"Dwarf Version", i32 4} |
| 55 |
!11 = !{i32 1, !"Debug Info Version", i32 3} |
| 56 |
!12 = !{!"clang version 3.5.0 "} |
| 57 |
!13 = !DILocalVariable(name: "dst", line: 1, arg: 1, scope: !4, file: !5, type: !8) |
| 58 |
!14 = !DILocation(line: 1, scope: !4) |
| 59 |
!15 = !DILocation(line: 2, scope: !4) |