| 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=x86_64-apple-darwin10.0.0 -filetype=obj %t.ll -o - | llvm-dwarfdump -v -debug-info - | FileCheck %s |
| 6 |
; RUN: llc -mtriple=x86_64-apple-darwin10.0.0 -filetype=obj %t.ll -regalloc=basic -o - | llvm-dwarfdump -v -debug-info - | FileCheck %s |
| 7 |
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" |
| 8 |
target triple = "spir64-unknown-unknown" |
| 9 |
; Test that the type for the formal parameter "var" makes it into the debug info. |
| 10 |
; rdar://8950491 |
| 11 |
|
| 12 |
;CHECK: DW_TAG_formal_parameter |
| 13 |
;CHECK-NEXT: DW_AT_location |
| 14 |
;CHECK-NEXT: DW_AT_name {{.*}} "var" |
| 15 |
;CHECK-NEXT: DW_AT_decl_file |
| 16 |
;CHECK-NEXT: DW_AT_decl_line |
| 17 |
;CHECK-NEXT: DW_AT_type |
| 18 |
|
| 19 |
@dfm = external global i32, align 4 |
| 20 |
|
| 21 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
| 22 |
|
| 23 |
define i32 @foo(i32 %dev, i64 %cmd, i8* %data, i32 %data2) nounwind optsize ssp !dbg !0 { |
| 24 |
entry: |
| 25 |
call void @llvm.dbg.value(metadata i32 %dev, metadata !12, metadata !DIExpression()), !dbg !13 |
| 26 |
%tmp.i = load i32, i32* @dfm, align 4, !dbg !14 |
| 27 |
%cmp.i = icmp eq i32 %tmp.i, 0, !dbg !14 |
| 28 |
br i1 %cmp.i, label %if.else, label %if.end.i, !dbg !14 |
| 29 |
|
| 30 |
if.end.i: ; preds = %entry |
| 31 |
switch i64 %cmd, label %if.then [ |
| 32 |
i64 2147772420, label %bb.i |
| 33 |
i64 536897538, label %bb116.i |
| 34 |
], !dbg !22 |
| 35 |
|
| 36 |
bb.i: ; preds = %if.end.i |
| 37 |
unreachable |
| 38 |
|
| 39 |
bb116.i: ; preds = %if.end.i |
| 40 |
unreachable |
| 41 |
|
| 42 |
if.then: ; preds = %if.end.i |
| 43 |
ret i32 undef, !dbg !23 |
| 44 |
|
| 45 |
if.else: ; preds = %entry |
| 46 |
ret i32 0 |
| 47 |
} |
| 48 |
|
| 49 |
declare hidden fastcc i32 @bar(i32, i32* nocapture) nounwind optsize ssp |
| 50 |
declare hidden fastcc i32 @bar2(i32) nounwind optsize ssp |
| 51 |
declare hidden fastcc i32 @bar3(i32) nounwind optsize ssp |
| 52 |
declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone |
| 53 |
|
| 54 |
!llvm.dbg.cu = !{!2} |
| 55 |
!llvm.module.flags = !{!29} |
| 56 |
|
| 57 |
!0 = distinct !DISubprogram(name: "foo", line: 19510, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, scopeLine: 19510, file: !26, scope: !1, type: !3) |
| 58 |
!1 = !DIFile(filename: "/tmp/f.c", directory: "/tmp") |
| 59 |
!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 124753)", isOptimized: true, emissionKind: FullDebug, file: !27, enums: !28, retainedTypes: !28, imports: null) |
| 60 |
!3 = !DISubroutineType(types: !4) |
| 61 |
!4 = !{!5} |
| 62 |
!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 63 |
!6 = distinct !DISubprogram(name: "bar3", line: 14827, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, file: !26, scope: !1, type: !3) |
| 64 |
!7 = distinct !DISubprogram(name: "bar2", line: 15397, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, file: !26, scope: !1, type: !3) |
| 65 |
!8 = distinct !DISubprogram(name: "bar", line: 12382, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, file: !26, scope: !1, type: !9) |
| 66 |
!9 = !DISubroutineType(types: !10) |
| 67 |
!10 = !{!11} |
| 68 |
!11 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned char", size: 8, align: 8, encoding: DW_ATE_unsigned_char) |
| 69 |
!12 = !DILocalVariable(name: "var", line: 19509, arg: 1, scope: !0, file: !1, type: !5) |
| 70 |
!13 = !DILocation(line: 19509, column: 20, scope: !0) |
| 71 |
!14 = !DILocation(line: 18091, column: 2, scope: !15, inlinedAt: !17) |
| 72 |
!15 = distinct !DILexicalBlock(line: 18086, column: 1, file: !26, scope: !16) |
| 73 |
!16 = distinct !DISubprogram(name: "foo_bar", line: 18086, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, file: !26, scope: !1, type: !3) |
| 74 |
!17 = !DILocation(line: 19514, column: 2, scope: !18) |
| 75 |
!18 = distinct !DILexicalBlock(line: 19510, column: 1, file: !26, scope: !0) |
| 76 |
!22 = !DILocation(line: 18094, column: 2, scope: !15, inlinedAt: !17) |
| 77 |
!23 = !DILocation(line: 19524, column: 1, scope: !18) |
| 78 |
!25 = !DIFile(filename: "f.i", directory: "/tmp") |
| 79 |
!26 = !DIFile(filename: "/tmp/f.c", directory: "/tmp") |
| 80 |
!27 = !DIFile(filename: "f.i", directory: "/tmp") |
| 81 |
!28 = !{} |
| 82 |
!29 = !{i32 1, !"Debug Info Version", i32 3} |