| 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 i686-pc-cygwin -O2 %t.ll -o - | FileCheck %s |
| 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 |
; Check struct X for dead variable xyz from inlined function foo. |
| 10 |
|
| 11 |
; CHECK: Lsection_info |
| 12 |
; CHECK: DW_TAG_structure_type |
| 13 |
; CHECK-NEXT: info_string |
| 14 |
|
| 15 |
source_filename = "test/DebugInfo/X86/InlinedFnLocalVar.ll" |
| 16 |
|
| 17 |
@i = common global i32 0, !dbg !0 |
| 18 |
|
| 19 |
; Function Attrs: nounwind readnone |
| 20 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 |
| 21 |
|
| 22 |
; Function Attrs: nounwind readnone |
| 23 |
declare void @llvm.dbg.value(metadata, metadata, metadata) #0 |
| 24 |
|
| 25 |
; Function Attrs: nounwind ssp |
| 26 |
define i32 @bar() #1 !dbg !8 { |
| 27 |
entry: |
| 28 |
%0 = load i32, i32* @i, align 4, !dbg !11 |
| 29 |
tail call void @llvm.dbg.value(metadata i32 %0, metadata !13, metadata !24), !dbg !25 |
| 30 |
tail call void @llvm.dbg.declare(metadata !5, metadata !18, metadata !24), !dbg !26 |
| 31 |
%1 = mul nsw i32 %0, %0, !dbg !27 |
| 32 |
store i32 %1, i32* @i, align 4, !dbg !11 |
| 33 |
ret i32 %1, !dbg !28 |
| 34 |
} |
| 35 |
|
| 36 |
attributes #0 = { nounwind readnone } |
| 37 |
attributes #1 = { nounwind ssp } |
| 38 |
|
| 39 |
!llvm.dbg.cu = !{!4} |
| 40 |
!llvm.module.flags = !{!7} |
| 41 |
|
| 42 |
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 43 |
!1 = !DIGlobalVariable(name: "i", scope: !2, file: !2, line: 5, type: !3, isLocal: false, isDefinition: true) |
| 44 |
!2 = !DIFile(filename: "bar.c", directory: "/tmp/") |
| 45 |
!3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 46 |
!4 = distinct !DICompileUnit(language: DW_LANG_C89, file: !2, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, imports: !5) |
| 47 |
!5 = !{} |
| 48 |
!6 = !{!0} |
| 49 |
!7 = !{i32 1, !"Debug Info Version", i32 3} |
| 50 |
!8 = distinct !DISubprogram(name: "bar", linkageName: "bar", scope: !2, file: !2, line: 14, type: !9, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4) |
| 51 |
!9 = !DISubroutineType(types: !10) |
| 52 |
!10 = !{!3} |
| 53 |
!11 = !DILocation(line: 15, scope: !12) |
| 54 |
!12 = distinct !DILexicalBlock(scope: !8, file: !2, line: 14) |
| 55 |
!13 = !DILocalVariable(name: "j", arg: 1, scope: !14, file: !2, line: 9, type: !3) |
| 56 |
!14 = distinct !DISubprogram(name: "foo", scope: !2, file: !2, line: 9, type: !15, isLocal: true, isDefinition: true, scopeLine: 9, virtualIndex: 6, isOptimized: true, unit: !4, retainedNodes: !17) |
| 57 |
!15 = !DISubroutineType(types: !16) |
| 58 |
!16 = !{!3, !3} |
| 59 |
!17 = !{!13, !18} |
| 60 |
!18 = !DILocalVariable(name: "xyz", scope: !19, file: !2, line: 10, type: !20) |
| 61 |
!19 = distinct !DILexicalBlock(scope: !14, file: !2, line: 9) |
| 62 |
!20 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", scope: !14, file: !2, line: 10, size: 64, align: 32, elements: !21) |
| 63 |
!21 = !{!22, !23} |
| 64 |
!22 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !20, file: !2, line: 10, baseType: !3, size: 32, align: 32) |
| 65 |
!23 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !20, file: !2, line: 10, baseType: !3, size: 32, align: 32, offset: 32) |
| 66 |
!24 = !DIExpression() |
| 67 |
!25 = !DILocation(line: 9, scope: !14, inlinedAt: !11) |
| 68 |
!26 = !DILocation(line: 9, scope: !19, inlinedAt: !11) |
| 69 |
!27 = !DILocation(line: 11, scope: !19, inlinedAt: !11) |
| 70 |
!28 = !DILocation(line: 16, scope: !12) |
| 71 |
|