blob: 2f1ccb493da89fe948df0f5bcec5d730ef5a7cc5 [file] [log] [blame]
Victor Hernandez3c3e2382010-01-26 02:42:15 +00001; RUN: opt < %s -mem2reg -S | FileCheck %s
2
Devang Patelfee8b922010-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]
10 call void @llvm.dbg.declare(metadata !{i32* %i_addr}, metadata !0), !dbg !8
Victor Hernandez3c3e2382010-01-26 02:42:15 +000011; CHECK: call void @llvm.dbg.value(metadata !{i32 %i}, i64 0, metadata !0)
Devang Patel844f82a2010-06-04 22:27:30 +000012; CHECK: call void @llvm.dbg.value(metadata !{double %j}, i64 0, metadata !9)
Devang Patelfee8b922010-05-07 20:34:00 +000013 store i32 %i, i32* %i_addr
14 call void @llvm.dbg.declare(metadata !{double* %j_addr}, metadata !9), !dbg !8
15 store double %j, double* %j_addr
16 %1 = load i32* %i_addr, align 4, !dbg !10 ; <i32> [#uses=1]
17 %2 = add nsw i32 %1, 1, !dbg !10 ; <i32> [#uses=1]
18 %3 = sitofp i32 %2 to double, !dbg !10 ; <double> [#uses=1]
19 %4 = load double* %j_addr, align 8, !dbg !10 ; <double> [#uses=1]
20 %5 = fadd double %3, %4, !dbg !10 ; <double> [#uses=1]
21 store double %5, double* %0, align 8, !dbg !10
22 %6 = load double* %0, align 8, !dbg !10 ; <double> [#uses=1]
23 store double %6, double* %retval, align 8, !dbg !10
24 br label %return, !dbg !10
25
26return: ; preds = %entry
27 %retval1 = load double* %retval, !dbg !10 ; <double> [#uses=1]
28 ret double %retval1, !dbg !10
Victor Hernandez3c3e2382010-01-26 02:42:15 +000029}
30
31declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
32
Devang Patelfee8b922010-05-07 20:34:00 +000033!0 = metadata !{i32 524545, metadata !1, metadata !"i", metadata !2, i32 2, metadata !7} ; [ DW_TAG_arg_variable ]
34!1 = metadata !{i32 524334, i32 0, metadata !2, metadata !"testfunc", metadata !"testfunc", metadata !"testfunc", metadata !2, i32 2, metadata !4, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 false} ; [ DW_TAG_subprogram ]
35!2 = metadata !{i32 524329, metadata !"testfunc.c", metadata !"/tmp", metadata !3} ; [ DW_TAG_file_type ]
36!3 = metadata !{i32 524305, i32 0, i32 1, metadata !"testfunc.c", metadata !"/tmp", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
37!4 = metadata !{i32 524309, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !5, i32 0, null} ; [ DW_TAG_subroutine_type ]
38!5 = metadata !{metadata !6, metadata !7, metadata !6}
39!6 = metadata !{i32 524324, metadata !2, metadata !"double", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, i32 4} ; [ DW_TAG_base_type ]
40!7 = metadata !{i32 524324, metadata !2, metadata !"int", metadata !2, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
41!8 = metadata !{i32 2, i32 0, metadata !1, null}
42!9 = metadata !{i32 524545, metadata !1, metadata !"j", metadata !2, i32 2, metadata !6} ; [ DW_TAG_arg_variable ]
43!10 = metadata !{i32 3, i32 0, metadata !11, null}
44!11 = metadata !{i32 524299, metadata !1, i32 2, i32 0} ; [ DW_TAG_lexical_block ]
Victor Hernandez3c3e2382010-01-26 02:42:15 +000045