Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; 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 |
Alexey Lapshin | cbf1f3b | 2019-09-04 14:19:49 +0000 | [diff] [blame] | 3 | ; XFAIL: * |
Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 4 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 5 | target triple = "x86_64-pc-linux-gnu" |
| 6 | |
| 7 | %foo = type { i64, i32, i32 } |
| 8 | |
| 9 | ; Function Attrs: nounwind readnone |
| 10 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 |
| 11 | declare void @llvm.dbg.value(metadata, metadata, metadata) #0 |
| 12 | |
| 13 | ; Function Attrs: sspreq |
| 14 | define void @julia_fastshortest_6256() #1 { |
| 15 | top: |
| 16 | %cp = alloca %foo, align 8 |
| 17 | %sink = alloca %foo, align 8 |
| 18 | call void @llvm.dbg.declare(metadata %foo* %cp, metadata !1, metadata !16), !dbg !17 |
| 19 | br i1 undef, label %idxend, label %fail |
| 20 | |
| 21 | fail: ; preds = %top |
| 22 | unreachable |
| 23 | |
| 24 | idxend: ; preds = %top |
| 25 | ; CHECK-NOT: call void @llvm.dbg.value(metadata %foo* %cp, |
| 26 | %0 = load %foo, %foo* %cp, align 8 |
| 27 | store volatile %foo %0, %foo *%sink, align 8 |
| 28 | ; CHECK: call void @llvm.dbg.value(metadata %foo % |
| 29 | store %foo %0, %foo* undef, align 8 |
| 30 | ret void |
| 31 | } |
| 32 | |
| 33 | ; Keep the declare if we keep the alloca. |
| 34 | ; DECLARE-LABEL: define void @julia_fastshortest_6256() |
| 35 | ; DECLARE: %cp = alloca %foo, align 8 |
| 36 | ; DECLARE: call void @llvm.dbg.declare(metadata %foo* %cp, |
| 37 | |
| 38 | attributes #0 = { nounwind readnone } |
| 39 | attributes #1 = { sspreq } |
| 40 | |
| 41 | !llvm.module.flags = !{!0} |
| 42 | !llvm.dbg.cu = !{!18} |
| 43 | |
| 44 | !0 = !{i32 1, !"Debug Info Version", i32 3} |
| 45 | !1 = !DILocalVariable(name: "cp", scope: !2, file: !3, line: 106, type: !12) |
| 46 | !2 = distinct !DISubprogram(name: "fastshortest", linkageName: "julia_fastshortest_6256", scope: null, file: !3, type: !4, isLocal: false, isDefinition: true, isOptimized: true, unit: !18, retainedNodes: !11) |
| 47 | !3 = !DIFile(filename: "grisu/fastshortest.jl", directory: ".") |
| 48 | !4 = !DISubroutineType(types: !5) |
| 49 | !5 = !{!6, !7} |
| 50 | !6 = !DIBasicType(name: "Float64", size: 64, align: 64, encoding: DW_ATE_unsigned) |
| 51 | !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64, align: 64) |
| 52 | !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "jl_value_t", file: !9, line: 71, align: 64, elements: !10) |
| 53 | !9 = !DIFile(filename: "julia.h", directory: "") |
| 54 | !10 = !{!7} |
| 55 | !11 = !{} |
| 56 | !12 = !DICompositeType(tag: DW_TAG_structure_type, name: "Float", size: 128, align: 64, elements: !13, runtimeLang: DW_LANG_Julia) |
| 57 | !13 = !{!14, !15, !15} |
| 58 | !14 = !DIBasicType(name: "UInt64", size: 64, align: 64, encoding: DW_ATE_unsigned) |
| 59 | !15 = !DIBasicType(name: "Int32", size: 32, align: 32, encoding: DW_ATE_unsigned) |
| 60 | !16 = !DIExpression() |
| 61 | !17 = !DILocation(line: 106, scope: !2) |
| 62 | !18 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3) |