xref: /llvm-project/llvm/test/DebugInfo/X86/sroasplit-5.ll (revision 3d4255787246b676f65e22b63b916b2bf679c9c0)
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; From:
5; struct prog_src_register {
6;   unsigned : 4;
7;   int Index : 12 + 1;
8;   unsigned : 12;
9;   unsigned : 4;
10;   int : 12 + 1
11; } src_reg_for_float() {
12;   struct prog_src_register a;
13;   memset(&a, 0, sizeof(a));
14;   int local = a.Index;
15;   return a;
16; }
17; ModuleID = 'pr22495.c'
18target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19target triple = "x86_64-unknown-linux-gnu"
20
21; When SROA is creating new smaller allocas, it may add padding.
22;
23; There should be no debug info for the padding.
24; CHECK-NOT: DW_OP_LLVM_fragment, 56
25; CHECK: DIExpression(DW_OP_LLVM_fragment, 0, 32)
26; CHECK-NOT: DW_OP_LLVM_fragment, 56
27; CHECK: DIExpression(DW_OP_LLVM_fragment, 32, 24)
28; CHECK-NOT: DW_OP_LLVM_fragment, 56
29%struct.prog_src_register = type { i32, i24 }
30
31; Function Attrs: nounwind
32define i64 @src_reg_for_float() #0 !dbg !4 {
33entry:
34  %retval = alloca %struct.prog_src_register, align 4
35  %a = alloca %struct.prog_src_register, align 4
36  %local = alloca i32, align 4
37  call void @llvm.dbg.declare(metadata ptr %a, metadata !16, metadata !17), !dbg !18
38  call void @llvm.memset.p0.i64(ptr align 4 %a, i8 0, i64 8, i1 false), !dbg !19
39  call void @llvm.dbg.declare(metadata ptr %local, metadata !20, metadata !17), !dbg !21
40  %bf.load = load i32, ptr %a, align 4, !dbg !21
41  %bf.shl = shl i32 %bf.load, 15, !dbg !21
42  %bf.ashr = ashr i32 %bf.shl, 19, !dbg !21
43  store i32 %bf.ashr, ptr %local, align 4, !dbg !21
44  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %retval, ptr align 4 %a, i64 8, i1 false), !dbg !22
45  %0 = load i64, ptr %retval, align 1, !dbg !22
46  ret i64 %0, !dbg !22
47}
48
49; Function Attrs: nounwind readnone
50declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
51
52; Function Attrs: nounwind
53declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) #2
54
55; Function Attrs: nounwind
56declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1) #2
57
58attributes #0 = { nounwind }
59attributes #1 = { nounwind readnone }
60attributes #2 = { nounwind }
61
62!llvm.dbg.cu = !{!0}
63!llvm.module.flags = !{!13, !14}
64!llvm.ident = !{!15}
65
66!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.7.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
67!1 = !DIFile(filename: "<stdin>", directory: "")
68!2 = !{}
69!4 = distinct !DISubprogram(name: "src_reg_for_float", line: 7, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, scopeLine: 7, file: !5, scope: !6, type: !7, retainedNodes: !2)
70!5 = !DIFile(filename: "pr22495.c", directory: "")
71!6 = !DIFile(filename: "pr22495.c", directory: "")
72!7 = !DISubroutineType(types: !8)
73!8 = !{!9}
74!9 = !DICompositeType(tag: DW_TAG_structure_type, name: "prog_src_register", line: 1, size: 64, align: 32, file: !5, elements: !10)
75!10 = !{!11}
76!11 = !DIDerivedType(tag: DW_TAG_member, name: "Index", line: 3, size: 13, align: 32, offset: 4, file: !5, scope: !9, baseType: !12)
77!12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
78!13 = !{i32 2, !"Dwarf Version", i32 4}
79!14 = !{i32 2, !"Debug Info Version", i32 3}
80!15 = !{!"clang version 3.7.0 "}
81!16 = !DILocalVariable(name: "a", line: 8, scope: !4, file: !6, type: !9)
82!17 = !DIExpression()
83!18 = !DILocation(line: 8, scope: !4)
84!19 = !DILocation(line: 9, scope: !4)
85!20 = !DILocalVariable(name: "local", line: 10, scope: !4, file: !6, type: !12)
86!21 = !DILocation(line: 10, scope: !4)
87!22 = !DILocation(line: 11, scope: !4)
88