| 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 -filetype=obj < %t.ll | llvm-dwarfdump -v - | FileCheck %s |
| 6 |
; Generated at -O2 from: |
| 7 |
; bool c(); |
| 8 |
; void f(); |
| 9 |
; bool start() { |
| 10 |
; bool result = c(); |
| 11 |
; if (!c()) { |
| 12 |
; result = false; |
| 13 |
; goto exit; |
| 14 |
; } |
| 15 |
; f(); |
| 16 |
; result = true; |
| 17 |
; exit: |
| 18 |
; return result; |
| 19 |
; } |
| 20 |
; |
| 21 |
; The constant should NOT be available for the entire function. |
| 22 |
; CHECK-NOT: DW_AT_const_value |
| 23 |
; CHECK: .debug_loc contents: |
| 24 |
; CHECK-NEXT: 0x00000000: |
| 25 |
; CHECK-NEXT: {{.*}}: DW_OP_lit1, DW_OP_stack_value |
| 26 |
|
| 27 |
source_filename = "test.ii" |
| 28 |
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
| 29 |
target triple = "spir64-unknown-unknown" |
| 30 |
|
| 31 |
; Function Attrs: noimplicitfloat noredzone nounwind optsize |
| 32 |
define zeroext i1 @_Z5startv() local_unnamed_addr #0 !dbg !7 { |
| 33 |
entry: |
| 34 |
%call = tail call zeroext i1 @_Z1cv() #3, !dbg !13 |
| 35 |
%call1 = tail call zeroext i1 @_Z1cv() #3, !dbg !14 |
| 36 |
br i1 %call1, label %if.end, label %exit, !dbg !16 |
| 37 |
|
| 38 |
if.end: ; preds = %entry |
| 39 |
tail call void @_Z1fv() #3, !dbg !17 |
| 40 |
tail call void @llvm.dbg.value(metadata i8 1, metadata !12, metadata !18), !dbg !19 |
| 41 |
br label %exit, !dbg !20 |
| 42 |
|
| 43 |
exit: ; preds = %entry, %if.end |
| 44 |
%result.0 = phi i1 [ true, %if.end ], [ false, %entry ] |
| 45 |
ret i1 %result.0, !dbg !21 |
| 46 |
} |
| 47 |
|
| 48 |
; Function Attrs: noimplicitfloat noredzone optsize |
| 49 |
declare zeroext i1 @_Z1cv() local_unnamed_addr #1 |
| 50 |
|
| 51 |
; Function Attrs: noimplicitfloat noredzone optsize |
| 52 |
declare void @_Z1fv() local_unnamed_addr #1 |
| 53 |
|
| 54 |
; Function Attrs: nounwind readnone speculatable |
| 55 |
declare void @llvm.dbg.value(metadata, metadata, metadata) #2 |
| 56 |
|
| 57 |
attributes #0 = { noimplicitfloat noredzone nounwind optsize } |
| 58 |
attributes #1 = { noimplicitfloat noredzone optsize } |
| 59 |
attributes #2 = { nounwind readnone speculatable } |
| 60 |
attributes #3 = { nobuiltin noimplicitfloat noredzone nounwind optsize } |
| 61 |
|
| 62 |
!llvm.dbg.cu = !{!0} |
| 63 |
!llvm.module.flags = !{!3, !4, !5} |
| 64 |
!llvm.ident = !{!6} |
| 65 |
|
| 66 |
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 303873) (llvm/trunk 303897)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) |
| 67 |
!1 = !DIFile(filename: "test.ii", directory: "/") |
| 68 |
!2 = !{} |
| 69 |
!3 = !{i32 2, !"Dwarf Version", i32 4} |
| 70 |
!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 71 |
!5 = !{i32 1, !"wchar_size", i32 4} |
| 72 |
!6 = !{!"clang version 5.0.0 (trunk 303873) (llvm/trunk 303897)"} |
| 73 |
!7 = distinct !DISubprogram(name: "start", linkageName: "_Z5startv", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11) |
| 74 |
!8 = !DISubroutineType(types: !9) |
| 75 |
!9 = !{!10} |
| 76 |
!10 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean) |
| 77 |
!11 = !{!12} |
| 78 |
!12 = !DILocalVariable(name: "result", scope: !7, file: !1, line: 4, type: !10) |
| 79 |
!13 = !DILocation(line: 4, column: 17, scope: !7) |
| 80 |
!14 = !DILocation(line: 5, column: 8, scope: !15) |
| 81 |
!15 = distinct !DILexicalBlock(scope: !7, file: !1, line: 5, column: 7) |
| 82 |
!16 = !DILocation(line: 5, column: 7, scope: !7) |
| 83 |
!17 = !DILocation(line: 9, column: 3, scope: !7) |
| 84 |
!18 = !DIExpression() |
| 85 |
!19 = !DILocation(line: 4, column: 8, scope: !7) |
| 86 |
!20 = !DILocation(line: 10, column: 3, scope: !7) |
| 87 |
!21 = !DILocation(line: 12, column: 3, scope: !7) |