| 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 %t.ll -filetype=obj -o - | llvm-dwarfdump -v --debug-info - | FileCheck %s |
| 6 |
; CHECK: DW_TAG_variable |
| 7 |
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg +0) |
| 8 |
; CHECK-NEXT: DW_AT_name {{.*}}"i" |
| 9 |
|
| 10 |
target datalayout = "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128" |
| 11 |
target triple = "spir64-unknown-unknown" |
| 12 |
|
| 13 |
; Function Attrs: nounwind uwtable |
| 14 |
declare i32 @foo(i32 %i) #0 |
| 15 |
|
| 16 |
; Function Attrs: nounwind readnone |
| 17 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| 18 |
|
| 19 |
; Function Attrs: nounwind uwtable |
| 20 |
define i32 @main() #0 !dbg !9 { |
| 21 |
entry: |
| 22 |
%retval = alloca i32, align 4 |
| 23 |
%i = alloca i32, align 4 |
| 24 |
store i32 0, i32* %retval |
| 25 |
call void @llvm.dbg.declare(metadata i32* %i, metadata !20, metadata !16), !dbg !21 |
| 26 |
store i32 20, i32* %i, align 4, !dbg !21 |
| 27 |
%0 = load i32, i32* %i, align 4, !dbg !22 |
| 28 |
%call = call i32 @foo(i32 %0), !dbg !23 |
| 29 |
ret i32 %call, !dbg !24 |
| 30 |
} |
| 31 |
|
| 32 |
attributes #0 = { nounwind uwtable } |
| 33 |
attributes #1 = { nounwind readnone } |
| 34 |
|
| 35 |
!llvm.dbg.cu = !{!0} |
| 36 |
!llvm.module.flags = !{!12, !13} |
| 37 |
!llvm.ident = !{!14} |
| 38 |
|
| 39 |
!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.7.0", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) |
| 40 |
!1 = !DIFile(filename: "x.c", directory: "") |
| 41 |
!2 = !{} |
| 42 |
!4 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2) |
| 43 |
!5 = !DIFile(filename: "x.c", directory: "") |
| 44 |
!6 = !DISubroutineType(types: !7) |
| 45 |
!7 = !{!8, !8} |
| 46 |
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 47 |
!9 = distinct !DISubprogram(name: "main", line: 8, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, scopeLine: 9, file: !1, scope: !5, type: !10, retainedNodes: !2) |
| 48 |
!10 = !DISubroutineType(types: !11) |
| 49 |
!11 = !{!8} |
| 50 |
!12 = !{i32 2, !"Dwarf Version", i32 4} |
| 51 |
!13 = !{i32 2, !"Debug Info Version", i32 3} |
| 52 |
!14 = !{!"clang version 3.7.0"} |
| 53 |
!15 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !4, file: !5, type: !8) |
| 54 |
!16 = !DIExpression() |
| 55 |
!17 = !DILocation(line: 2, column: 10, scope: !4) |
| 56 |
!18 = !DILocation(line: 4, column: 10, scope: !4) |
| 57 |
!19 = !DILocation(line: 4, column: 3, scope: !4) |
| 58 |
!20 = !DILocalVariable(name: "i", line: 10, scope: !9, file: !5, type: !8) |
| 59 |
!21 = !DILocation(line: 10, column: 7, scope: !9) |
| 60 |
!22 = !DILocation(line: 11, column: 15, scope: !9) |
| 61 |
!23 = !DILocation(line: 11, column: 10, scope: !9) |
| 62 |
!24 = !DILocation(line: 11, column: 3, scope: !9) |