blob: caaec391dfb6140e2f4dd6932f177e25ecc3324d [file] [log] [blame]
Adrian Prantl565cc182015-01-20 19:42:22 +00001; RUN: opt %s -sroa -verify -S -o - | FileCheck %s
2; ModuleID = 'test.c'
3; Test that SROA updates the debug info correctly if an alloca was rewritten but
4; not partitioned into multiple allocas.
5;
6; CHECK: call void @llvm.dbg.value(metadata float %s.coerce, i64 0, metadata ![[VAR:[0-9]+]], metadata ![[EXPR:[0-9]+]])
7; CHECK: ![[VAR]] = {{.*}} [ DW_TAG_arg_variable ] [s] [line 3]
8; CHECK: ![[EXPR]] = {{.*}} [ DW_TAG_expression ]
Adrian Prantl27bd01f2015-02-09 23:57:15 +00009; CHECK-NOT: DW_OP_bit_piece
Adrian Prantl565cc182015-01-20 19:42:22 +000010
11;
12; struct S { float f; };
13;
14; float foo(struct S s) {
15; return s.f;
16; }
17target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
18target triple = "x86_64-apple-macosx10.10.0"
19
20%struct.S = type { float }
21
22; Function Attrs: nounwind ssp uwtable
23define float @foo(float %s.coerce) #0 {
24entry:
25 %s = alloca %struct.S, align 4
David Blaikie79e6c742015-02-27 19:29:02 +000026 %coerce.dive = getelementptr %struct.S, %struct.S* %s, i32 0, i32 0
Adrian Prantl565cc182015-01-20 19:42:22 +000027 store float %s.coerce, float* %coerce.dive, align 1
28 call void @llvm.dbg.declare(metadata %struct.S* %s, metadata !16, metadata !17), !dbg !18
David Blaikie79e6c742015-02-27 19:29:02 +000029 %f = getelementptr inbounds %struct.S, %struct.S* %s, i32 0, i32 0, !dbg !19
David Blaikiea79ac142015-02-27 21:17:42 +000030 %0 = load float, float* %f, align 4, !dbg !19
Adrian Prantl565cc182015-01-20 19:42:22 +000031 ret float %0, !dbg !19
32}
33
34; Function Attrs: nounwind readnone
35declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
36
37attributes #0 = { nounwind ssp uwtable }
38attributes #1 = { nounwind readnone }
39
40!llvm.dbg.cu = !{!0}
41!llvm.module.flags = !{!12, !13, !14}
42!llvm.ident = !{!15}
43
44!0 = !{!"0x11\0012\00clang version 3.6.0 \000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/Volumes/Data/llvm/_build.ninja.debug/test.c] [DW_LANG_C99]
45!1 = !{!"test.c", !"/Volumes/Data/llvm/_build.ninja.debug"}
46!2 = !{}
47!3 = !{!4}
48!4 = !{!"0x2e\00foo\00foo\00\003\000\001\000\000\00256\000\003", !1, !5, !6, null, float (float)* @foo, null, null, !2} ; [ DW_TAG_subprogram ] [line 3] [def] [foo]
49!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [/Volumes/Data/llvm/_build.ninja.debug/test.c]
50!6 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
51!7 = !{!8, !9}
52!8 = !{!"0x24\00float\000\0032\0032\000\000\004", null, null} ; [ DW_TAG_base_type ] [float] [line 0, size 32, align 32, offset 0, enc DW_ATE_float]
53!9 = !{!"0x13\00S\001\0032\0032\000\000\000", !1, null, null, !10, null, null, null} ; [ DW_TAG_structure_type ] [S] [line 1, size 32, align 32, offset 0] [def] [from ]
54!10 = !{!11}
55!11 = !{!"0xd\00f\001\0032\0032\000\000", !1, !9, !8} ; [ DW_TAG_member ] [f] [line 1, size 32, align 32, offset 0] [from float]
56!12 = !{i32 2, !"Dwarf Version", i32 2}
57!13 = !{i32 2, !"Debug Info Version", i32 2}
58!14 = !{i32 1, !"PIC Level", i32 2}
59!15 = !{!"clang version 3.6.0 "}
60!16 = !{!"0x101\00s\0016777219\000", !4, !5, !9} ; [ DW_TAG_arg_variable ] [s] [line 3]
61!17 = !{!"0x102"} ; [ DW_TAG_expression ]
62!18 = !MDLocation(line: 3, column: 20, scope: !4)
63!19 = !MDLocation(line: 4, column: 2, scope: !4)