1; RUN: opt -passes=instcombine -instcombine-lower-dbg-declare=1 -S < %s | FileCheck %s 2; RUN: opt -passes=instcombine -instcombine-lower-dbg-declare=0 -S < %s | FileCheck %s --check-prefix=DECLARE 3; XFAIL: * 4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-pc-linux-gnu" 6 7%foo = type { i64, i32, i32 } 8 9; Function Attrs: nounwind readnone 10declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 11declare void @llvm.dbg.value(metadata, metadata, metadata) #0 12 13; Function Attrs: sspreq 14define void @julia_fastshortest_6256(i1 %c1) #1 { 15top: 16 %cp = alloca %foo, align 8 17 %sink = alloca %foo, align 8 18 call void @llvm.dbg.declare(metadata ptr %cp, metadata !1, metadata !16), !dbg !17 19 br i1 %c1, label %idxend, label %fail 20 21fail: ; preds = %top 22 unreachable 23 24idxend: ; preds = %top 25; CHECK-NOT: call void @llvm.dbg.value(metadata ptr %cp, 26 %0 = load %foo, ptr %cp, align 8 27 store volatile %foo %0, ptr %sink, align 8 28; CHECK: call void @llvm.dbg.value(metadata %foo % 29 store %foo %0, ptr 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 ptr %cp, 37 38attributes #0 = { nounwind readnone } 39attributes #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) 63