llvm.org GIT mirror llvm / 080b5ab
Add test coverage for mem2reg dbg.declare lowering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301050 91177308-0d34-0410-b5e6-96231b3b80d8 Adrian Prantl 2 years ago
1 changed file(s) with 48 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: opt < %s -mem2reg -S | FileCheck %s
1 source_filename = "bugpoint-output.bc"
2 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-apple-macosx10.12.0"
4
5 define void @scan() #0 !dbg !12 {
6 entry:
7 %entry1 = alloca i8, align 8
8 call void @llvm.dbg.declare(metadata i8* %entry1, metadata !18, metadata !19), !dbg !20
9 store i8 0, i8* %entry1, align 8, !dbg !20
10 br label %for.cond, !dbg !20
11
12 for.cond:
13 ; CHECK: %[[PHI:.*]] = phi i8 [ 0, %entry ], [ %0, %for.cond ]
14 %entryN = load i8, i8* %entry1, align 8, !dbg !20
15 ; CHECK: call void @llvm.dbg.value(metadata i8 %[[PHI]], i64 0,
16 ; CHECK-SAME: metadata ![[EXPR:[0-9]+]])
17 %0 = add i8 %entryN, 1
18 ; CHECK: %0 = add i8 %[[PHI]], 1
19 ; CHECK: call void @llvm.dbg.value(metadata i8 %0, i64 0,
20 ; CHECK-SAME: metadata ![[EXPR]])
21 store i8 %0, i8* %entry1, align 8, !dbg !20
22 br label %for.cond, !dbg !20
23 }
24
25 ; CHECK: ![[EXPR]] = !DIExpression()
26
27 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
28
29 attributes #0 = { nounwind ssp uwtable }
30 attributes #1 = { nounwind readnone }
31
32 !llvm.dbg.cu = !{!0}
33 !llvm.module.flags = !{!10, !11}
34
35 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "adrian", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
36 !1 = !DIFile(filename: "", directory: "/")
37 !2 = !{}
38 !4 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
39 !10 = !{i32 2, !"Debug Info Version", i32 3}
40 !11 = !{i32 1, !"PIC Level", i32 2}
41 !12 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !13, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !15)
42 !13 = !DISubroutineType(types: !14)
43 !14 = !{null, !4, !4}
44 !15 = !{!18}
45 !18 = !DILocalVariable(name: "entry", scope: !12, file: !1, line: 6, type: !4)
46 !19 = !DIExpression()
47 !20 = !DILocation(line: 6, scope: !12)