xref: /llvm-project/llvm/test/DebugInfo/X86/align_objc.ll (revision 5a288fa32e0c91b211e39f3e370255916902f898)
1; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s --implicit-check-not=DW_TAG
2
3; typedef struct __attribute__((aligned (128))) {
4;   char c;
5; } S0;
6;
7; typedef struct {
8;   __attribute__((aligned (64))) char c;
9; } S1;
10;
11; S0 s0;
12;
13; void f() {
14;   S1 s1;
15;   __attribute__((aligned (32))) int i;
16; }
17
18; CHECK: DW_TAG_compile_unit
19; CHECK:   DW_TAG_variable
20; CHECK:   DW_TAG_typedef
21; CHECK:     DW_AT_name{{.*}}"S0"
22
23; CHECK:   DW_TAG_structure_type
24; CHECK:     DW_AT_alignment{{.*}}128
25; CHECK:     DW_TAG_member
26; CHECK:   DW_TAG_base_type
27
28; CHECK:   DW_TAG_subprogram
29; CHECK:     DW_TAG_variable
30; CHECK:     DW_TAG_variable
31; CHECK:       DW_AT_name{{.*}}"i"
32; CHECK:       DW_AT_alignment{{.*}}32
33
34; CHECK:   DW_TAG_typedef
35; CHECK:     DW_AT_name{{.*}}"S1"
36; CHECK:   DW_TAG_structure_type
37; CHECK:     DW_TAG_member
38; CHECK:       DW_AT_name{{.*}}"c"
39; CHECK:       DW_AT_alignment{{.*}}64
40; CHECK:   DW_TAG_base_type
41
42; ModuleID = 'test.m'
43source_filename = "test.m"
44target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
45target triple = "x86_64-unknown-linux-gnu"
46
47%struct.S0 = type { i8, [127 x i8] }
48%struct.S1 = type { i8, [63 x i8] }
49
50@s0 = common global %struct.S0 zeroinitializer, align 128, !dbg !0
51
52; Function Attrs: nounwind uwtable
53define void @f() #0 !dbg !14 {
54entry:
55  %s1 = alloca %struct.S1, align 64
56  %i = alloca i32, align 32
57  call void @llvm.dbg.declare(metadata ptr %s1, metadata !17, metadata !22), !dbg !23
58  call void @llvm.dbg.declare(metadata ptr %i, metadata !24, metadata !22), !dbg !26
59  ret void, !dbg !27
60}
61
62; Function Attrs: nounwind readnone
63declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
64
65attributes #0 = { nounwind uwtable }
66attributes #1 = { nounwind readnone }
67
68!llvm.dbg.cu = !{!2}
69!llvm.module.flags = !{!11, !12}
70!llvm.ident = !{!13}
71
72!0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
73!1 = !DIGlobalVariable(name: "s0", scope: !2, file: !3, line: 10, type: !6, isLocal: false, isDefinition: true)
74!2 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !3, producer: "clang version 4.0.0", isOptimized: false, runtimeVersion: 1, emissionKind: FullDebug, enums: !4, globals: !5)
75!3 = !DIFile(filename: "test.m", directory: "/tmp")
76!4 = !{}
77!5 = !{!0}
78!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "S0", file: !3, line: 3, baseType: !7)
79!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3, line: 1, size: 1024, align: 1024, elements: !8)
80!8 = !{!9}
81!9 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !7, file: !3, line: 2, baseType: !10, size: 8)
82!10 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
83!11 = !{i32 2, !"Dwarf Version", i32 4}
84!12 = !{i32 2, !"Debug Info Version", i32 3}
85!13 = !{!"clang version 4.0.0"}
86!14 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 12, type: !15, isLocal: false, isDefinition: true, scopeLine: 12, isOptimized: false, unit: !2, retainedNodes: !4)
87!15 = !DISubroutineType(types: !16)
88!16 = !{null}
89!17 = !DILocalVariable(name: "s1", scope: !14, file: !3, line: 13, type: !18)
90!18 = !DIDerivedType(tag: DW_TAG_typedef, name: "S1", file: !3, line: 8, baseType: !19)
91!19 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3, line: 6, size: 512, elements: !20)
92!20 = !{!21}
93!21 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !19, file: !3, line: 7, baseType: !10, size: 8, align: 512)
94!22 = !DIExpression()
95!23 = !DILocation(line: 13, column: 6, scope: !14)
96!24 = !DILocalVariable(name: "i", scope: !14, file: !3, line: 14, type: !25, align: 256)
97!25 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
98!26 = !DILocation(line: 14, column: 37, scope: !14)
99!27 = !DILocation(line: 15, column: 1, scope: !14)
100
101