xref: /llvm-project/llvm/test/DebugInfo/X86/sroasplit-3.ll (revision 094572701dce4aaf36f4521d6cf750420d39f206)
1; RUN: opt %s -passes='sroa,verify' -S -o - | FileCheck %s
2; RUN: opt --try-experimental-debuginfo-iterators %s -passes='sroa,verify' -S -o - | FileCheck %s
3
4; ModuleID = 'test.c'
5; Test that SROA updates the debug info correctly if an alloca was rewritten but
6; not partitioned into multiple allocas.
7;
8; CHECK: #dbg_value(float %s.coerce, ![[VAR:[0-9]+]], !DIExpression(),
9; CHECK: ![[VAR]] = !DILocalVariable(name: "s",{{.*}} line: 3,
10
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 !dbg !4 {
24entry:
25  %s = alloca %struct.S, align 4
26  store float %s.coerce, ptr %s, align 1
27  call void @llvm.dbg.declare(metadata ptr %s, metadata !16, metadata !17), !dbg !18
28  %0 = load float, ptr %s, align 4, !dbg !19
29  ret float %0, !dbg !19
30}
31
32; Function Attrs: nounwind readnone
33declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
34
35attributes #0 = { nounwind ssp uwtable }
36attributes #1 = { nounwind readnone }
37
38!llvm.dbg.cu = !{!0}
39!llvm.module.flags = !{!12, !13, !14}
40!llvm.ident = !{!15}
41
42!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
43!1 = !DIFile(filename: "test.c", directory: "/Volumes/Data/llvm/_build.ninja.debug")
44!2 = !{}
45!4 = distinct !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2)
46!5 = !DIFile(filename: "test.c", directory: "/Volumes/Data/llvm/_build.ninja.debug")
47!6 = !DISubroutineType(types: !7)
48!7 = !{!8, !9}
49!8 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
50!9 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 1, size: 32, align: 32, file: !1, elements: !10)
51!10 = !{!11}
52!11 = !DIDerivedType(tag: DW_TAG_member, name: "f", line: 1, size: 32, align: 32, file: !1, scope: !9, baseType: !8)
53!12 = !{i32 2, !"Dwarf Version", i32 2}
54!13 = !{i32 2, !"Debug Info Version", i32 3}
55!14 = !{i32 1, !"PIC Level", i32 2}
56!15 = !{!"clang version 3.6.0 "}
57!16 = !DILocalVariable(name: "s", line: 3, arg: 1, scope: !4, file: !5, type: !9)
58!17 = !DIExpression()
59!18 = !DILocation(line: 3, column: 20, scope: !4)
60!19 = !DILocation(line: 4, column: 2, scope: !4)
61