| 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=asm -fast-isel=false -O0 < %t.ll | FileCheck %s |
| 6 |
; |
| 7 |
; Generated by: |
| 8 |
; clang -emit-llvm -S -g test.cpp |
| 9 |
|
| 10 |
; typedef double fp_t; |
| 11 |
; typedef unsigned long int_t; |
| 12 |
; |
| 13 |
; int_t glb_start = 17; |
| 14 |
; int_t glb_end = 42; |
| 15 |
; |
| 16 |
; int main() |
| 17 |
; { |
| 18 |
; int_t start = glb_start; |
| 19 |
; int_t end = glb_end; |
| 20 |
; |
| 21 |
; fp_t dbl_start = (fp_t) start; |
| 22 |
; fp_t dbl_end = (fp_t) end; |
| 23 |
; |
| 24 |
; return 0; |
| 25 |
; } |
| 26 |
|
| 27 |
; SelectionDAG performs CSE on constant pool loads. Make sure line numbers |
| 28 |
; from such nodes are not propagated. Doing so results in oscillating line numbers. |
| 29 |
|
| 30 |
; CHECK: .loc 1 12 |
| 31 |
; CHECK: .loc 1 13 |
| 32 |
; CHECK-NOT: .loc 1 12 |
| 33 |
|
| 34 |
; ModuleID = 't.cpp' |
| 35 |
source_filename = "test/DebugInfo/X86/isel-cse-line.ll" |
| 36 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 37 |
target triple = "spir64-unknown-unknown" |
| 38 |
|
| 39 |
@glb_start = global i64 17, align 8, !dbg !0 |
| 40 |
@glb_end = global i64 42, align 8, !dbg !9 |
| 41 |
|
| 42 |
define i32 @main() !dbg !16 { |
| 43 |
%1 = alloca i32, align 4 |
| 44 |
%2 = alloca i64, align 8 |
| 45 |
%3 = alloca i64, align 8 |
| 46 |
%4 = alloca double, align 8 |
| 47 |
%5 = alloca double, align 8 |
| 48 |
store i32 0, i32* %1, align 4 |
| 49 |
call void @llvm.dbg.declare(metadata i64* %2, metadata !20, metadata !21), !dbg !22 |
| 50 |
%6 = load i64, i64* @glb_start, align 8, !dbg !23 |
| 51 |
store i64 %6, i64* %2, align 8, !dbg !22 |
| 52 |
call void @llvm.dbg.declare(metadata i64* %3, metadata !24, metadata !21), !dbg !25 |
| 53 |
%7 = load i64, i64* @glb_end, align 8, !dbg !26 |
| 54 |
store i64 %7, i64* %3, align 8, !dbg !25 |
| 55 |
call void @llvm.dbg.declare(metadata double* %4, metadata !27, metadata !21), !dbg !28 |
| 56 |
%8 = load i64, i64* %2, align 8, !dbg !29 |
| 57 |
%9 = uitofp i64 %8 to double, !dbg !29 |
| 58 |
store double %9, double* %4, align 8, !dbg !28 |
| 59 |
call void @llvm.dbg.declare(metadata double* %5, metadata !30, metadata !21), !dbg !31 |
| 60 |
%10 = load i64, i64* %3, align 8, !dbg !32 |
| 61 |
%11 = uitofp i64 %10 to double, !dbg !32 |
| 62 |
store double %11, double* %5, align 8, !dbg !31 |
| 63 |
ret i32 0, !dbg !33 |
| 64 |
} |
| 65 |
|
| 66 |
; Function Attrs: nounwind readnone |
| 67 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 |
| 68 |
|
| 69 |
attributes #0 = { nounwind readnone } |
| 70 |
|
| 71 |
!llvm.dbg.cu = !{!2} |
| 72 |
!llvm.module.flags = !{!13, !14} |
| 73 |
!llvm.ident = !{!15} |
| 74 |
|
| 75 |
!0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 76 |
!1 = !DIGlobalVariable(name: "glb_start", scope: !2, file: !3, line: 4, type: !11, isLocal: false, isDefinition: true) |
| 77 |
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.9.0 (trunk 268246)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !8) |
| 78 |
!3 = !DIFile(filename: "/home/wpieb/test/D12094.cpp", directory: "/home/wpieb/build/llvm/trunk/llvm-RelWithDebInfo") |
| 79 |
!4 = !{} |
| 80 |
!5 = !{!6} |
| 81 |
!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "fp_t", file: !3, line: 1, baseType: !7) |
| 82 |
!7 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float) |
| 83 |
!8 = !{!0, !9} |
| 84 |
!9 = distinct !DIGlobalVariableExpression(var: !10, expr: !DIExpression()) |
| 85 |
!10 = !DIGlobalVariable(name: "glb_end", scope: !2, file: !3, line: 5, type: !11, isLocal: false, isDefinition: true) |
| 86 |
!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "int_t", file: !3, line: 2, baseType: !12) |
| 87 |
!12 = !DIBasicType(name: "long unsigned int", size: 64, align: 64, encoding: DW_ATE_unsigned) |
| 88 |
!13 = !{i32 2, !"Dwarf Version", i32 4} |
| 89 |
!14 = !{i32 2, !"Debug Info Version", i32 3} |
| 90 |
!15 = !{!"clang version 3.9.0 (trunk 268246)"} |
| 91 |
!16 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 7, type: !17, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4) |
| 92 |
!17 = !DISubroutineType(types: !18) |
| 93 |
!18 = !{!19} |
| 94 |
!19 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 95 |
!20 = !DILocalVariable(name: "start", scope: !16, file: !3, line: 9, type: !11) |
| 96 |
!21 = !DIExpression() |
| 97 |
!22 = !DILocation(line: 9, column: 9, scope: !16) |
| 98 |
!23 = !DILocation(line: 9, column: 17, scope: !16) |
| 99 |
!24 = !DILocalVariable(name: "end", scope: !16, file: !3, line: 10, type: !11) |
| 100 |
!25 = !DILocation(line: 10, column: 9, scope: !16) |
| 101 |
!26 = !DILocation(line: 10, column: 17, scope: !16) |
| 102 |
!27 = !DILocalVariable(name: "dbl_start", scope: !16, file: !3, line: 12, type: !6) |
| 103 |
!28 = !DILocation(line: 12, column: 8, scope: !16) |
| 104 |
!29 = !DILocation(line: 12, column: 27, scope: !16) |
| 105 |
!30 = !DILocalVariable(name: "dbl_end", scope: !16, file: !3, line: 13, type: !6) |
| 106 |
!31 = !DILocation(line: 13, column: 8, scope: !16) |
| 107 |
!32 = !DILocation(line: 13, column: 27, scope: !16) |
| 108 |
!33 = !DILocation(line: 15, column: 3, scope: !16) |
| 109 |
|