| 1 |
; RUN: llvm-as < %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_INTEL_variable_length_array |
| 3 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll |
| 4 |
|
| 5 |
; RUN: llc < %t.ll -O0 -mtriple x86_64-apple-darwin | FileCheck %s |
| 6 |
; RUN: llc < %t.ll -O0 -mtriple x86_64-apple-darwin -filetype=obj \ |
| 7 |
; RUN: | llvm-dwarfdump -v - --debug-info | FileCheck %s --check-prefix=DWARF |
| 8 |
|
| 9 |
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" |
| 10 |
target triple = "spir64-unknown-unknown" |
| 11 |
; <rdar://problem/11134152> |
| 12 |
|
| 13 |
; CHECK-LABEL: _foo: |
| 14 |
; CHECK-NOT: #DEBUG_VALUE |
| 15 |
|
| 16 |
; "[DW_FORM_exprloc] <0x2> 91 XX" means fbreg uleb(XX) |
| 17 |
; DWARF-LABEL: DW_TAG_formal_parameter |
| 18 |
; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg -8) |
| 19 |
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}} = "x") |
| 20 |
|
| 21 |
; FIXME: There is no debug info to describe "a". |
| 22 |
|
| 23 |
define i32 @foo(i32* %x) nounwind uwtable ssp !dbg !5 { |
| 24 |
entry: |
| 25 |
%x.addr = alloca i32*, align 8 |
| 26 |
%saved_stack = alloca i8* |
| 27 |
%cleanup.dest.slot = alloca i32 |
| 28 |
store i32* %x, i32** %x.addr, align 8 |
| 29 |
call void @llvm.dbg.declare(metadata i32** %x.addr, metadata !14, metadata !DIExpression()), !dbg !15 |
| 30 |
%0 = load i32*, i32** %x.addr, align 8, !dbg !16 |
| 31 |
%1 = load i32, i32* %0, align 4, !dbg !16 |
| 32 |
%2 = zext i32 %1 to i64, !dbg !16 |
| 33 |
%3 = call i8* @llvm.stacksave(), !dbg !16 |
| 34 |
store i8* %3, i8** %saved_stack, !dbg !16 |
| 35 |
%vla = alloca i8, i64 %2, align 16, !dbg !16 |
| 36 |
call void @llvm.dbg.declare(metadata i8* %vla, metadata !18, metadata !DIExpression()), !dbg !23 |
| 37 |
store i32 1, i32* %cleanup.dest.slot |
| 38 |
%4 = load i8*, i8** %saved_stack, !dbg !24 |
| 39 |
call void @llvm.stackrestore(i8* %4), !dbg !24 |
| 40 |
ret i32 0, !dbg !25 |
| 41 |
} |
| 42 |
|
| 43 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
| 44 |
|
| 45 |
declare i8* @llvm.stacksave() nounwind |
| 46 |
|
| 47 |
declare void @llvm.stackrestore(i8*) nounwind |
| 48 |
|
| 49 |
!llvm.dbg.cu = !{!0} |
| 50 |
!llvm.module.flags = !{!27} |
| 51 |
|
| 52 |
!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.1 (trunk 153698)", isOptimized: false, emissionKind: FullDebug, file: !26, enums: !1, retainedTypes: !1, globals: !1) |
| 53 |
!1 = !{} |
| 54 |
!5 = distinct !DISubprogram(name: "foo", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !26, scope: !0, type: !7) |
| 55 |
!6 = !DIFile(filename: "20020104-2.c", directory: "/Volumes/Sandbox/llvm") |
| 56 |
!7 = !DISubroutineType(types: !8) |
| 57 |
!8 = !{!9, !10} |
| 58 |
!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 59 |
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !11) |
| 60 |
!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !9) |
| 61 |
!14 = !DILocalVariable(name: "x", line: 5, arg: 1, scope: !5, file: !6, type: !10) |
| 62 |
!15 = !DILocation(line: 5, column: 21, scope: !5) |
| 63 |
!16 = !DILocation(line: 7, column: 13, scope: !17) |
| 64 |
!17 = distinct !DILexicalBlock(line: 6, column: 1, file: !26, scope: !5) |
| 65 |
!18 = !DILocalVariable(name: "a", line: 7, scope: !17, file: !6, type: !19) |
| 66 |
!19 = !DICompositeType(tag: DW_TAG_array_type, align: 8, baseType: !20, elements: !21) |
| 67 |
!20 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) |
| 68 |
!21 = !{!22} |
| 69 |
!22 = !DISubrange(count: -1) |
| 70 |
!23 = !DILocation(line: 7, column: 8, scope: !17) |
| 71 |
!24 = !DILocation(line: 9, column: 1, scope: !17) |
| 72 |
!25 = !DILocation(line: 8, column: 3, scope: !17) |
| 73 |
!26 = !DIFile(filename: "20020104-2.c", directory: "/Volumes/Sandbox/llvm") |
| 74 |
!27 = !{i32 1, !"Debug Info Version", i32 3} |