blob: 0e9119de5b0710faa846bea9c04dca582128ce9e [file] [log] [blame]
Victor Leschuk3c989982016-10-26 11:59:03 +00001; RUN: %llc_dwarf -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
2; REQUIRES: object-emission
3
4; Generated by clang -c -g -std=c11 -S -emit-llvm from the following C11 source
5;
6; // every object of type struct data will be aligned to 128-byte boundary
7; struct data {
8; char x;
9; _Alignas(128) char arr[2];
10; };
11;
12; _Alignas(2048) struct data d; // this instance of data is aligned even stricter
13; int foo(void)
14; {
15; struct data local_data;
16; return 0;
17; }
18
19; CHECK: DW_TAG_variable
20; CHECK-NOT: DW_TAG
21; CHECK: DW_AT_name{{.*}}"d"
22; CHECK-NOT: DW_TAG
23; CHECK: DW_AT_alignment{{.*}}2048
24; CHECK: DW_TAG_structure_type
25; CHECK: DW_TAG_member
26; CHECK: DW_TAG_member
27; CHECK-NOT: DW_TAG
28; CHECK: DW_AT_name{{.*}}"arr"
29; CHECK-NOT: DW_TAG
30; CHECK: DW_AT_alignment{{.*}}128
31
32; ModuleID = 'test.c'
33source_filename = "test.c"
34target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
35target triple = "x86_64-unknown-linux-gnu"
36
37%struct.data = type { i8, [127 x i8], [2 x i8], [126 x i8] }
38
39@d = common global %struct.data zeroinitializer, align 2048, !dbg !0
40
41; Function Attrs: nounwind uwtable
42define i32 @foo() #0 !dbg !17 {
43entry:
44 %local_data = alloca %struct.data, align 128
45 call void @llvm.dbg.declare(metadata %struct.data* %local_data, metadata !21, metadata !22), !dbg !23
46 ret i32 0, !dbg !24
47}
48
49; Function Attrs: nounwind readnone
50declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
51
52attributes #0 = { nounwind uwtable }
53attributes #1 = { nounwind readnone }
54
55!llvm.dbg.cu = !{!1}
56!llvm.module.flags = !{!14, !15}
57!llvm.ident = !{!16}
58
59!0 = distinct !DIGlobalVariable(name: "d", scope: !1, file: !5, line: 7, type: !6, isLocal: false, isDefinition: true, align: 16384)
60!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)
61!2 = !DIFile(filename: "test.c", directory: "/tmp")
62!3 = !{}
63!4 = !{!0}
64!5 = !DIFile(filename: "test.c", directory: "/tmp")
65!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "data", file: !5, line: 2, size: 2048, elements: !7)
66!7 = !{!8, !10}
67!8 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !6, file: !5, line: 3, baseType: !9, size: 8)
68!9 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
69!10 = !DIDerivedType(tag: DW_TAG_member, name: "arr", scope: !6, file: !5, line: 4, baseType: !11, size: 16, align: 1024, offset: 1024)
70!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 16, elements: !12)
71!12 = !{!13}
72!13 = !DISubrange(count: 2)
73!14 = !{i32 2, !"Dwarf Version", i32 4}
74!15 = !{i32 2, !"Debug Info Version", i32 3}
75!16 = !{!"clang version 4.0.0 (http://llvm.org/git/clang.git 9ce5220b821054019059c2ac4a9b132c7723832d) (http://llvm.org/git/llvm.git 9a6298be89ce0359b151c0a37af2776a12c69e85)"}
76!17 = distinct !DISubprogram(name: "foo", scope: !5, file: !5, line: 8, type: !18, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !1, variables: !3)
77!18 = !DISubroutineType(types: !19)
78!19 = !{!20}
79!20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
80!21 = !DILocalVariable(name: "local_data", scope: !17, file: !5, line: 10, type: !6)
81!22 = !DIExpression()
82!23 = !DILocation(line: 10, column: 17, scope: !17)
83!24 = !DILocation(line: 11, column: 5, scope: !17)