blob: 5aba8804c240217a0ce84c1e9f53afdcf46948b3 [file] [log] [blame]
Reid Kleckner8a1cd912017-09-13 01:43:25 +00001; RUN: opt -instcombine -instcombine-lower-dbg-declare=1 -S < %s | FileCheck %s
2; RUN: opt -instcombine -instcombine-lower-dbg-declare=0 -S < %s | FileCheck %s --check-prefix=DECLARE
Keno Fischer00cbf9a2015-12-19 02:02:44 +00003target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-pc-linux-gnu"
5
6%foo = type { i64, i32, i32 }
7
8; Function Attrs: nounwind readnone
9declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
Adrian Prantlabe04752017-07-28 20:21:02 +000010declare void @llvm.dbg.value(metadata, metadata, metadata) #0
Keno Fischer00cbf9a2015-12-19 02:02:44 +000011
12; Function Attrs: sspreq
13define void @julia_fastshortest_6256() #1 {
14top:
15 %cp = alloca %foo, align 8
16 call void @llvm.dbg.declare(metadata %foo* %cp, metadata !1, metadata !16), !dbg !17
17 br i1 undef, label %idxend, label %fail
18
19fail: ; preds = %top
20 unreachable
21
22idxend: ; preds = %top
Benjamin Kramerdb9e0b62017-01-22 20:28:56 +000023; CHECK-NOT: call void @llvm.dbg.value(metadata %foo* %cp,
Keno Fischer00cbf9a2015-12-19 02:02:44 +000024 %0 = load volatile %foo, %foo* %cp, align 8
Adrian Prantlf9516422016-04-11 18:15:44 +000025; CHECK: call void @llvm.dbg.value(metadata %foo %0,
Keno Fischer00cbf9a2015-12-19 02:02:44 +000026 store volatile %foo %0, %foo* undef, align 8
27 ret void
28}
29
Reid Kleckner8a1cd912017-09-13 01:43:25 +000030; Keep the declare if we keep the alloca.
31; DECLARE-LABEL: define void @julia_fastshortest_6256()
32; DECLARE: %cp = alloca %foo, align 8
33; DECLARE: call void @llvm.dbg.declare(metadata %foo* %cp,
34
Keno Fischer00cbf9a2015-12-19 02:02:44 +000035attributes #0 = { nounwind readnone }
36attributes #1 = { sspreq }
37
38!llvm.module.flags = !{!0}
Adrian Prantlf9516422016-04-11 18:15:44 +000039!llvm.dbg.cu = !{!18}
Keno Fischer00cbf9a2015-12-19 02:02:44 +000040
41!0 = !{i32 1, !"Debug Info Version", i32 3}
42!1 = !DILocalVariable(name: "cp", scope: !2, file: !3, line: 106, type: !12)
Adrian Prantl75819ae2016-04-15 15:57:41 +000043!2 = distinct !DISubprogram(name: "fastshortest", linkageName: "julia_fastshortest_6256", scope: null, file: !3, type: !4, isLocal: false, isDefinition: true, isOptimized: true, unit: !18, variables: !11)
Keno Fischer00cbf9a2015-12-19 02:02:44 +000044!3 = !DIFile(filename: "grisu/fastshortest.jl", directory: ".")
45!4 = !DISubroutineType(types: !5)
46!5 = !{!6, !7}
47!6 = !DIBasicType(name: "Float64", size: 64, align: 64, encoding: DW_ATE_unsigned)
48!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64, align: 64)
49!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "jl_value_t", file: !9, line: 71, align: 64, elements: !10)
50!9 = !DIFile(filename: "julia.h", directory: "")
51!10 = !{!7}
52!11 = !{}
53!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "Float", size: 128, align: 64, elements: !13, runtimeLang: DW_LANG_Julia)
54!13 = !{!14, !15, !15}
55!14 = !DIBasicType(name: "UInt64", size: 64, align: 64, encoding: DW_ATE_unsigned)
56!15 = !DIBasicType(name: "Int32", size: 32, align: 32, encoding: DW_ATE_unsigned)
57!16 = !DIExpression()
58!17 = !DILocation(line: 106, scope: !2)
Adrian Prantl75819ae2016-04-15 15:57:41 +000059!18 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3)