xref: /aosp_15_r20/external/llvm/test/DebugInfo/ARM/PR26163.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker;
3*9880d681SAndroid Build Coastguard Worker; Checks that we're creating two ranges, one that terminates immediately
4*9880d681SAndroid Build Coastguard Worker; and one that spans the rest of the function. This isn't necessarily the
5*9880d681SAndroid Build Coastguard Worker; best thing to do here (and also not necessarily correct, since the first
6*9880d681SAndroid Build Coastguard Worker; one has a bit_piece), but it is what is currently being emitted, any
7*9880d681SAndroid Build Coastguard Worker; change here needs to be intentional, so the test is very specific.
8*9880d681SAndroid Build Coastguard Worker;
9*9880d681SAndroid Build Coastguard Worker; CHECK: .debug_loc contents:
10*9880d681SAndroid Build Coastguard Worker; CHECK: 0x00000000: Beginning address offset: 0x0000000000000004
11*9880d681SAndroid Build Coastguard Worker; CHECK:                Ending address offset: 0x0000000000000004
12*9880d681SAndroid Build Coastguard Worker; CHECK:                 Location description: 10 00 9f
13*9880d681SAndroid Build Coastguard Worker; CHECK:             Beginning address offset: 0x0000000000000004
14*9880d681SAndroid Build Coastguard Worker; CHECK:                Ending address offset: 0x0000000000000014
15*9880d681SAndroid Build Coastguard Worker; CHECK:                 Location description: 10 00 9f
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; Created form the following test case (PR26163) with
18*9880d681SAndroid Build Coastguard Worker; clang -cc1 -triple armv4t--freebsd11.0-gnueabi -emit-obj -debug-info-kind=standalone -O2 -x c test.c
19*9880d681SAndroid Build Coastguard Worker;
20*9880d681SAndroid Build Coastguard Worker; typedef	unsigned int	size_t;
21*9880d681SAndroid Build Coastguard Worker; struct timeval {
22*9880d681SAndroid Build Coastguard Worker; 	long long tv_sec;
23*9880d681SAndroid Build Coastguard Worker; 	int tv_usec;
24*9880d681SAndroid Build Coastguard Worker; };
25*9880d681SAndroid Build Coastguard Worker;
26*9880d681SAndroid Build Coastguard Worker; void *memset(void *, int, size_t);
27*9880d681SAndroid Build Coastguard Worker; void foo(void);
28*9880d681SAndroid Build Coastguard Worker;
29*9880d681SAndroid Build Coastguard Worker; static void
30*9880d681SAndroid Build Coastguard Worker; bar(int value)
31*9880d681SAndroid Build Coastguard Worker; {
32*9880d681SAndroid Build Coastguard Worker; 	struct timeval lifetime;
33*9880d681SAndroid Build Coastguard Worker;
34*9880d681SAndroid Build Coastguard Worker; 	memset(&lifetime, 0, sizeof(struct timeval));
35*9880d681SAndroid Build Coastguard Worker; 	lifetime.tv_sec = value;
36*9880d681SAndroid Build Coastguard Worker;
37*9880d681SAndroid Build Coastguard Worker; 	foo();
38*9880d681SAndroid Build Coastguard Worker; }
39*9880d681SAndroid Build Coastguard Worker;
40*9880d681SAndroid Build Coastguard Worker; int
41*9880d681SAndroid Build Coastguard Worker; parse_config_file(void)
42*9880d681SAndroid Build Coastguard Worker; {
43*9880d681SAndroid Build Coastguard Worker; 	int value;
44*9880d681SAndroid Build Coastguard Worker;
45*9880d681SAndroid Build Coastguard Worker; 	bar(value);
46*9880d681SAndroid Build Coastguard Worker; 	return (0);
47*9880d681SAndroid Build Coastguard Worker; }
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
50*9880d681SAndroid Build Coastguard Workertarget triple = "armv4t--freebsd11.0-gnueabi"
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker%struct.timeval = type { i64, i32 }
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata)
55*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata)
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Workerdeclare void @foo()
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workerdefine i32 @parse_config_file() !dbg !4 {
60*9880d681SAndroid Build Coastguard Workerentry:
61*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !15, metadata !26), !dbg !27
62*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.declare(metadata %struct.timeval* undef, metadata !16, metadata !26), !dbg !29
63*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i64 0, i64 0, metadata !16, metadata !30), !dbg !29
64*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !16, metadata !31), !dbg !29
65*9880d681SAndroid Build Coastguard Worker  tail call void @foo() #3, !dbg !32
66*9880d681SAndroid Build Coastguard Worker  ret i32 0, !dbg !33
67*9880d681SAndroid Build Coastguard Worker}
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
71*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!22, !23, !24}
72*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!25}
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257891)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
75*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "<stdin>", directory: "/home/ubuntu/bugs")
76*9880d681SAndroid Build Coastguard Worker!2 = !{}
77*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "parse_config_file", scope: !5, file: !5, line: 22, type: !6, isLocal: false, isDefinition: true, scopeLine: 23, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !9)
78*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "test.c", directory: "/home/ubuntu/bugs")
79*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7)
80*9880d681SAndroid Build Coastguard Worker!7 = !{!8}
81*9880d681SAndroid Build Coastguard Worker!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
82*9880d681SAndroid Build Coastguard Worker!9 = !{!10}
83*9880d681SAndroid Build Coastguard Worker!10 = !DILocalVariable(name: "value", scope: !4, file: !5, line: 24, type: !8)
84*9880d681SAndroid Build Coastguard Worker!11 = distinct !DISubprogram(name: "bar", scope: !5, file: !5, line: 11, type: !12, isLocal: true, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !14)
85*9880d681SAndroid Build Coastguard Worker!12 = !DISubroutineType(types: !13)
86*9880d681SAndroid Build Coastguard Worker!13 = !{null, !8}
87*9880d681SAndroid Build Coastguard Worker!14 = !{!15, !16}
88*9880d681SAndroid Build Coastguard Worker!15 = !DILocalVariable(name: "value", arg: 1, scope: !11, file: !5, line: 11, type: !8)
89*9880d681SAndroid Build Coastguard Worker!16 = !DILocalVariable(name: "lifetime", scope: !11, file: !5, line: 13, type: !17)
90*9880d681SAndroid Build Coastguard Worker!17 = !DICompositeType(tag: DW_TAG_structure_type, name: "timeval", file: !5, line: 2, size: 128, align: 64, elements: !18)
91*9880d681SAndroid Build Coastguard Worker!18 = !{!19, !21}
92*9880d681SAndroid Build Coastguard Worker!19 = !DIDerivedType(tag: DW_TAG_member, name: "tv_sec", scope: !17, file: !5, line: 3, baseType: !20, size: 64, align: 64)
93*9880d681SAndroid Build Coastguard Worker!20 = !DIBasicType(name: "long long int", size: 64, align: 64, encoding: DW_ATE_signed)
94*9880d681SAndroid Build Coastguard Worker!21 = !DIDerivedType(tag: DW_TAG_member, name: "tv_usec", scope: !17, file: !5, line: 4, baseType: !8, size: 32, align: 32, offset: 64)
95*9880d681SAndroid Build Coastguard Worker!22 = !{i32 2, !"Debug Info Version", i32 3}
96*9880d681SAndroid Build Coastguard Worker!23 = !{i32 1, !"wchar_size", i32 4}
97*9880d681SAndroid Build Coastguard Worker!24 = !{i32 1, !"min_enum_size", i32 4}
98*9880d681SAndroid Build Coastguard Worker!25 = !{!"clang version 3.9.0 (https://github.com/llvm-mirror/clang 89dda3855cda574f355e6defa1d77bdae5053994) (llvm/trunk 257891)"}
99*9880d681SAndroid Build Coastguard Worker!26 = !DIExpression()
100*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 11, scope: !11, inlinedAt: !28)
101*9880d681SAndroid Build Coastguard Worker!28 = distinct !DILocation(line: 26, scope: !4)
102*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 13, scope: !11, inlinedAt: !28)
103*9880d681SAndroid Build Coastguard Worker!30 = !DIExpression(DW_OP_bit_piece, 0, 64)
104*9880d681SAndroid Build Coastguard Worker!31 = !DIExpression(DW_OP_bit_piece, 0, 32)
105*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 18, scope: !11, inlinedAt: !28)
106*9880d681SAndroid Build Coastguard Worker!33 = !DILocation(line: 27, scope: !4)
107