Clean up the processing of dbg.value in various places
[oota-llvm.git] / test / Transforms / Util / simplify-dbg-declare-load.ll
1 ; RUN: opt -instcombine -S < %s | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-pc-linux-gnu"
4
5 %foo = type { i64, i32, i32 }
6
7 ; Function Attrs: nounwind readnone
8 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
9 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0
10
11 ; Function Attrs: sspreq
12 define void @julia_fastshortest_6256() #1 {
13 top:
14   %cp = alloca %foo, align 8
15   call void @llvm.dbg.declare(metadata %foo* %cp, metadata !1, metadata !16), !dbg !17
16   br i1 undef, label %idxend, label %fail
17
18 fail:                                             ; preds = %top
19   unreachable
20
21 idxend:                                           ; preds = %top
22 ; CHECK-NOT call void @llvm.dbg.value(metadata %foo* %cp, i64 0, metadata !1, metadata !16), !dbg !17
23   %0 = load volatile %foo, %foo* %cp, align 8
24 ; CHECK: call void @llvm.dbg.value(metadata %foo %0, i64 0, metadata !1, metadata !16), !dbg !17
25   store volatile %foo %0, %foo* undef, align 8
26   ret void
27 }
28
29 attributes #0 = { nounwind readnone }
30 attributes #1 = { sspreq }
31
32 !llvm.module.flags = !{!0}
33 !llvm.dbg.cu = !{}
34
35 !0 = !{i32 1, !"Debug Info Version", i32 3}
36 !1 = !DILocalVariable(name: "cp", scope: !2, file: !3, line: 106, type: !12)
37 !2 = distinct !DISubprogram(name: "fastshortest", linkageName: "julia_fastshortest_6256", scope: null, file: !3, type: !4, isLocal: false, isDefinition: true, isOptimized: true, variables: !11)
38 !3 = !DIFile(filename: "grisu/fastshortest.jl", directory: ".")
39 !4 = !DISubroutineType(types: !5)
40 !5 = !{!6, !7}
41 !6 = !DIBasicType(name: "Float64", size: 64, align: 64, encoding: DW_ATE_unsigned)
42 !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64, align: 64)
43 !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "jl_value_t", file: !9, line: 71, align: 64, elements: !10)
44 !9 = !DIFile(filename: "julia.h", directory: "")
45 !10 = !{!7}
46 !11 = !{}
47 !12 = !DICompositeType(tag: DW_TAG_structure_type, name: "Float", size: 128, align: 64, elements: !13, runtimeLang: DW_LANG_Julia)
48 !13 = !{!14, !15, !15}
49 !14 = !DIBasicType(name: "UInt64", size: 64, align: 64, encoding: DW_ATE_unsigned)
50 !15 = !DIBasicType(name: "Int32", size: 32, align: 32, encoding: DW_ATE_unsigned)
51 !16 = !DIExpression()
52 !17 = !DILocation(line: 106, scope: !2)