xref: /llvm-project/llvm/test/DebugInfo/Generic/sroa-larger.ll (revision 094572701dce4aaf36f4521d6cf750420d39f206)
1; RUN: opt -passes='sroa' -S -o - %s | FileCheck %s
2; RUN: opt --try-experimental-debuginfo-iterators -passes='sroa' -S -o - %s | FileCheck %s
3; Generated from clang -c  -O2 -g -target x86_64-pc-windows-msvc
4; struct A {
5;   int _Myval2;
6;   A() : _Myval2() {}
7; };
8; struct B {
9;   double buffer[];
10; };
11; struct C {
12;   C(int) {}
13;   A _Mypair;
14; };
15; int getPtr();
16; struct D {
17;   C takePayload() {
18;     C Tmp(getPtr());
19;     return Tmp;
20;   }
21; } Dd;
22; ptr operator new(size_t, ptr);
23; struct F {
24;   F(D Err) : HasError() {
25;     C *e = (C *)(ErrorStorage.buffer);
26;     new (e) C(Err.takePayload());
27;   }
28;   B ErrorStorage;
29;   bool HasError;
30; };
31; F fn2() { return Dd; }
32; void fn3() { fn2(); }
33source_filename = "test.ll"
34
35%struct.F = type { %struct.B, i8 }
36%struct.B = type { [0 x double], [8 x i8] }
37
38define void @"\01?fn3@@YAXXZ"() local_unnamed_addr !dbg !6 {
39entry:
40  %tmp = alloca %struct.F, align 8
41  call void @llvm.lifetime.start.p0(i64 16, ptr %tmp)
42  call void @llvm.dbg.declare(metadata ptr %tmp, metadata !10, metadata !DIExpression()), !dbg !14
43  ; CHECK-NOT: !DIExpression(DW_OP_LLVM_fragment, 32, 96)
44  ; CHECK: #dbg_value(i32 0, !10, !DIExpression(),
45  store i32 0, ptr %tmp, align 8
46  ret void
47}
48
49; Function Attrs: argmemonly nounwind
50declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #0
51
52; Function Attrs: nounwind readnone speculatable
53declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
54
55attributes #0 = { argmemonly nounwind }
56attributes #1 = { nounwind readnone speculatable }
57
58!llvm.dbg.cu = !{!0}
59!llvm.module.flags = !{!2, !3, !4, !5}
60
61!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 319178) (llvm/trunk 319187)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
62!1 = !DIFile(filename: "test.cpp", directory: "/")
63!2 = !{i32 2, !"Dwarf Version", i32 4}
64!3 = !{i32 2, !"Debug Info Version", i32 3}
65!4 = !{i32 1, !"wchar_size", i32 2}
66!5 = !{i32 7, !"PIC Level", i32 2}
67!6 = distinct !DISubprogram(name: "fn3", linkageName: "\01?fn3@@YAXXZ", scope: !1, file: !1, line: 30, type: !7, isLocal: false, isDefinition: true, scopeLine: 30, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !9)
68!7 = !DISubroutineType(types: !8)
69!8 = !{null}
70!9 = !{}
71!10 = !DILocalVariable(name: "Tmp", scope: !11, file: !1, line: 16, type: !23)
72!11 = distinct !DISubprogram(name: "takePayload", linkageName: "\01?takePayload@D@@QEAA?AUC@@XZ", scope: !12, file: !1, line: 15, type: !7, isLocal: false, isDefinition: true, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !13, retainedNodes: !9)
73!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "D", file: !1, line: 14, size: 8, elements: !9, identifier: ".?AUD@@")
74!13 = !DISubprogram(name: "takePayload", linkageName: "\01?takePayload@D@@QEAA?AUC@@XZ", scope: !12, file: !1, line: 15, type: !7, isLocal: false, isDefinition: false, scopeLine: 15, flags: DIFlagPrototyped, isOptimized: true)
75!14 = !DILocation(line: 16, column: 7, scope: !11, inlinedAt: !15)
76!15 = distinct !DILocation(line: 24, column: 19, scope: !16, inlinedAt: !20)
77!16 = distinct !DILexicalBlock(scope: !17, file: !1, line: 22, column: 25)
78!17 = distinct !DISubprogram(name: "F", linkageName: "\01??0F@@QEAA@UD@@@Z", scope: !18, file: !1, line: 22, type: !7, isLocal: false, isDefinition: true, scopeLine: 22, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !19, retainedNodes: !9)
79!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "F", file: !1, line: 21, size: 128, elements: !9, identifier: ".?AUF@@")
80!19 = !DISubprogram(name: "F", scope: !18, file: !1, line: 22, type: !7, isLocal: false, isDefinition: false, scopeLine: 22, flags: DIFlagPrototyped, isOptimized: true)
81!20 = distinct !DILocation(line: 29, column: 18, scope: !21, inlinedAt: !22)
82!21 = distinct !DISubprogram(name: "fn2", linkageName: "\01?fn2@@YA?AUF@@XZ", scope: !1, file: !1, line: 29, type: !7, isLocal: false, isDefinition: true, scopeLine: 29, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !9)
83!22 = distinct !DILocation(line: 30, column: 14, scope: !6)
84!23 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !1, line: 9, size: 32, elements: !9, identifier: ".?AUC@@")
85