blob: 425b234b1d558546ed269a82c899680c9e4725b6 [file] [log] [blame]
Manman Rene9a52e12013-07-29 18:12:58 +00001; RUN: opt < %s -mem2reg -S | FileCheck %s
Victor Hernandezcd944102010-01-26 02:42:15 +00002
Devang Patelbe8ee1a2010-05-07 20:34:00 +00003define double @testfunc(i32 %i, double %j) nounwind ssp {
4entry:
5 %i_addr = alloca i32 ; <i32*> [#uses=2]
6 %j_addr = alloca double ; <double*> [#uses=2]
7 %retval = alloca double ; <double*> [#uses=2]
8 %0 = alloca double ; <double*> [#uses=2]
9 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000010 call void @llvm.dbg.declare(metadata i32* %i_addr, metadata !0, metadata !DIExpression()), !dbg !8
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000011; CHECK: call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata ![[IVAR:[0-9]*]], metadata {{.*}})
12; CHECK: call void @llvm.dbg.value(metadata double %j, i64 0, metadata ![[JVAR:[0-9]*]], metadata {{.*}})
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000013; CHECK: ![[IVAR]] = !DILocalVariable(name: "i"
14; CHECK: ![[JVAR]] = !DILocalVariable(name: "j"
Devang Patelbe8ee1a2010-05-07 20:34:00 +000015 store i32 %i, i32* %i_addr
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000016 call void @llvm.dbg.declare(metadata double* %j_addr, metadata !9, metadata !DIExpression()), !dbg !8
Devang Patelbe8ee1a2010-05-07 20:34:00 +000017 store double %j, double* %j_addr
David Blaikiea79ac142015-02-27 21:17:42 +000018 %1 = load i32, i32* %i_addr, align 4, !dbg !10 ; <i32> [#uses=1]
Devang Patelbe8ee1a2010-05-07 20:34:00 +000019 %2 = add nsw i32 %1, 1, !dbg !10 ; <i32> [#uses=1]
20 %3 = sitofp i32 %2 to double, !dbg !10 ; <double> [#uses=1]
David Blaikiea79ac142015-02-27 21:17:42 +000021 %4 = load double, double* %j_addr, align 8, !dbg !10 ; <double> [#uses=1]
Devang Patelbe8ee1a2010-05-07 20:34:00 +000022 %5 = fadd double %3, %4, !dbg !10 ; <double> [#uses=1]
23 store double %5, double* %0, align 8, !dbg !10
David Blaikiea79ac142015-02-27 21:17:42 +000024 %6 = load double, double* %0, align 8, !dbg !10 ; <double> [#uses=1]
Devang Patelbe8ee1a2010-05-07 20:34:00 +000025 store double %6, double* %retval, align 8, !dbg !10
26 br label %return, !dbg !10
27
28return: ; preds = %entry
David Blaikiea79ac142015-02-27 21:17:42 +000029 %retval1 = load double, double* %retval, !dbg !10 ; <double> [#uses=1]
Devang Patelbe8ee1a2010-05-07 20:34:00 +000030 ret double %retval1, !dbg !10
Victor Hernandezcd944102010-01-26 02:42:15 +000031}
32
Adrian Prantl87b7eb92014-10-01 18:55:02 +000033declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Victor Hernandezcd944102010-01-26 02:42:15 +000034
David Blaikie0d221152013-03-13 22:05:21 +000035!llvm.dbg.cu = !{!3}
Manman Ren409558f2013-11-22 21:49:45 +000036!llvm.module.flags = !{!14}
David Blaikie0d221152013-03-13 22:05:21 +000037
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000038!0 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !1, file: !2, type: !7)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000039!1 = !DISubprogram(name: "testfunc", linkageName: "testfunc", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 2, file: !12, scope: !2, type: !4, function: double (i32, double)* @testfunc)
40!2 = !DIFile(filename: "testfunc.c", directory: "/tmp")
41!3 = !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: 0, file: !12, enums: !13, retainedTypes: !13)
42!4 = !DISubroutineType(types: !5)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000043!5 = !{!6, !7, !6}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000044!6 = !DIBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 64, encoding: DW_ATE_float)
45!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
46!8 = !DILocation(line: 2, scope: !1)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000047!9 = !DILocalVariable(name: "j", line: 2, arg: 2, scope: !1, file: !2, type: !6)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000048!10 = !DILocation(line: 3, scope: !11)
49!11 = distinct !DILexicalBlock(line: 2, column: 0, file: !12, scope: !1)
50!12 = !DIFile(filename: "testfunc.c", directory: "/tmp")
Duncan P. N. Exon Smith988a7f82015-03-27 20:46:33 +000051!13 = !{}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000052!14 = !{i32 1, !"Debug Info Version", i32 3}