• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3target 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
10declare void @llvm.dbg.value(metadata, metadata, metadata) #0
11
12; Function Attrs: sspreq
13define void @julia_fastshortest_6256() #1 {
14top:
15  %cp = alloca %foo, align 8
16  %sink = alloca %foo, align 8
17  call void @llvm.dbg.declare(metadata %foo* %cp, metadata !1, metadata !16), !dbg !17
18  br i1 undef, label %idxend, label %fail
19
20fail:                                             ; preds = %top
21  unreachable
22
23idxend:                                           ; preds = %top
24; CHECK-NOT: call void @llvm.dbg.value(metadata %foo* %cp,
25  %0 = load %foo, %foo* %cp, align 8
26  store volatile %foo %0, %foo *%sink, align 8
27; CHECK: call void @llvm.dbg.value(metadata %foo %
28  store %foo %0, %foo* undef, align 8
29  ret void
30}
31
32; Keep the declare if we keep the alloca.
33; DECLARE-LABEL: define void @julia_fastshortest_6256()
34; DECLARE: %cp = alloca %foo, align 8
35; DECLARE: call void @llvm.dbg.declare(metadata %foo* %cp,
36
37attributes #0 = { nounwind readnone }
38attributes #1 = { sspreq }
39
40!llvm.module.flags = !{!0}
41!llvm.dbg.cu = !{!18}
42
43!0 = !{i32 1, !"Debug Info Version", i32 3}
44!1 = !DILocalVariable(name: "cp", scope: !2, file: !3, line: 106, type: !12)
45!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)
46!3 = !DIFile(filename: "grisu/fastshortest.jl", directory: ".")
47!4 = !DISubroutineType(types: !5)
48!5 = !{!6, !7}
49!6 = !DIBasicType(name: "Float64", size: 64, align: 64, encoding: DW_ATE_unsigned)
50!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64, align: 64)
51!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "jl_value_t", file: !9, line: 71, align: 64, elements: !10)
52!9 = !DIFile(filename: "julia.h", directory: "")
53!10 = !{!7}
54!11 = !{}
55!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "Float", size: 128, align: 64, elements: !13, runtimeLang: DW_LANG_Julia)
56!13 = !{!14, !15, !15}
57!14 = !DIBasicType(name: "UInt64", size: 64, align: 64, encoding: DW_ATE_unsigned)
58!15 = !DIBasicType(name: "Int32", size: 32, align: 32, encoding: DW_ATE_unsigned)
59!16 = !DIExpression()
60!17 = !DILocation(line: 106, scope: !2)
61!18 = distinct !DICompileUnit(language: DW_LANG_Julia, file: !3)
62