xref: /llvm-project/llvm/test/DebugInfo/X86/dwarf-aranges-g1.ll (revision a22a22a73c8ac5d4976d923afd60e7a1cf7346da)
1; REQUIRES: system-linux
2; RUN: llc -O0 --function-sections --generate-arange-section -filetype=obj %s -o %tmain.obj
3; RUN: llvm-dwarfdump --debug-info %tmain.obj > %tmain.txt
4; RUN: llvm-dwarfdump --debug-aranges %tmain.obj >> %tmain.txt
5; RUN: cat %tmain.txt | FileCheck --check-prefix=CHECK %s
6
7; CHECK: DW_AT_ranges
8; CHECK-NEXT: [0x[[#%.16x,ADDR:]], 0x[[#%.16x,ADDR1:]])
9; CHECK-NEXT: [0x[[#%.16x,ADDR2:]], 0x[[#%.16x,ADDR3:]])
10; CHECK-NEXT: [0x[[#%.16x,ADDR4:]], 0x[[#%.16x,ADDR5:]])
11
12; CHECK: Address Range Header
13; CHECK-NEXT: [0x[[#ADDR]], 0x[[#ADDR1]])
14; CHECK-NEXT: [0x[[#ADDR2]], 0x[[#ADDR3]])
15; CHECK-NEXT: [0x[[#ADDR4]], 0x[[#ADDR5]])
16
17; ModuleID = 'example.cpp'
18source_filename = "example.cpp"
19target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
20target triple = "x86_64-unknown-linux-gnu"
21
22%struct.S = type { ptr }
23
24@GlobalConst = dso_local global i32 42, align 4
25@Global = dso_local global i32 0, align 4
26@s = dso_local global %struct.S zeroinitializer, align 8
27
28; Function Attrs: alwaysinline mustprogress nounwind uwtable
29define dso_local noundef i32 @_Z6squarei(i32 noundef %i) #0 !dbg !10 {
30entry:
31  %i.addr = alloca i32, align 4
32  store i32 %i, ptr %i.addr, align 4
33  %0 = load i32, ptr %i.addr, align 4, !dbg !13
34  %1 = load i32, ptr %i.addr, align 4, !dbg !14
35  %mul = mul nsw i32 %0, %1, !dbg !15
36  ret i32 %mul, !dbg !16
37}
38
39; Function Attrs: mustprogress noinline nounwind optnone uwtable
40define dso_local noundef i32 @_Z4cubei(i32 noundef %i) #1 !dbg !17 {
41entry:
42  %i.addr.i = alloca i32, align 4
43  %i.addr = alloca i32, align 4
44  %squared = alloca i32, align 4
45  store i32 %i, ptr %i.addr, align 4
46  %0 = load i32, ptr %i.addr, align 4, !dbg !18
47  store i32 %0, ptr %i.addr.i, align 4
48  %1 = load i32, ptr %i.addr.i, align 4, !dbg !19
49  %2 = load i32, ptr %i.addr.i, align 4, !dbg !21
50  %mul.i = mul nsw i32 %1, %2, !dbg !22
51  store i32 %mul.i, ptr %squared, align 4, !dbg !23
52  %3 = load i32, ptr %squared, align 4, !dbg !24
53  %4 = load i32, ptr %i.addr, align 4, !dbg !25
54  %mul = mul nsw i32 %3, %4, !dbg !26
55  ret i32 %mul, !dbg !27
56}
57
58; Function Attrs: mustprogress noinline norecurse nounwind optnone uwtable
59define dso_local noundef i32 @main() #2 !dbg !28 {
60entry:
61  %retval = alloca i32, align 4
62  store i32 0, ptr %retval, align 4
63  ret i32 0, !dbg !29
64}
65
66attributes #0 = { alwaysinline mustprogress nounwind uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
67attributes #1 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
68attributes #2 = { mustprogress noinline norecurse nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
69
70!llvm.dbg.cu = !{!0}
71!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
72!llvm.ident = !{!9}
73
74!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 16.0.0 (ssh://git.vip.facebook.com/data/gitrepos/osmeta/external/llvm-project a312c5cce360203b4b24757e1e69738f8b3f2ec1)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, nameTableKind: None)
75!1 = !DIFile(filename: "example.cpp", directory: "/examples")
76!2 = !{i32 7, !"Dwarf Version", i32 4}
77!3 = !{i32 2, !"Debug Info Version", i32 3}
78!4 = !{i32 1, !"wchar_size", i32 4}
79!5 = !{i32 8, !"PIC Level", i32 2}
80!6 = !{i32 7, !"PIE Level", i32 2}
81!7 = !{i32 7, !"uwtable", i32 2}
82!8 = !{i32 7, !"frame-pointer", i32 2}
83!9 = !{!"clang version 16.0.0"}
84!10 = distinct !DISubprogram(name: "square", scope: !1, file: !1, line: 11, type: !11, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)
85!11 = !DISubroutineType(types: !12)
86!12 = !{}
87!13 = !DILocation(line: 11, column: 59, scope: !10)
88!14 = !DILocation(line: 11, column: 63, scope: !10)
89!15 = !DILocation(line: 11, column: 61, scope: !10)
90!16 = !DILocation(line: 11, column: 52, scope: !10)
91!17 = distinct !DISubprogram(name: "cube", scope: !1, file: !1, line: 12, type: !11, scopeLine: 12, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)
92!18 = !DILocation(line: 13, column: 24, scope: !17)
93!19 = !DILocation(line: 11, column: 59, scope: !10, inlinedAt: !20)
94!20 = distinct !DILocation(line: 13, column: 17, scope: !17)
95!21 = !DILocation(line: 11, column: 63, scope: !10, inlinedAt: !20)
96!22 = !DILocation(line: 11, column: 61, scope: !10, inlinedAt: !20)
97!23 = !DILocation(line: 13, column: 7, scope: !17)
98!24 = !DILocation(line: 14, column: 10, scope: !17)
99!25 = !DILocation(line: 14, column: 18, scope: !17)
100!26 = !DILocation(line: 14, column: 17, scope: !17)
101!27 = !DILocation(line: 14, column: 3, scope: !17)
102!28 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 17, type: !11, scopeLine: 17, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)
103!29 = !DILocation(line: 18, column: 3, scope: !28)
104