97 lines · plain
1; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=none -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s2; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=all -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=SECTIONS3; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=none -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s4; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=all -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=SECTIONS5 6; CHECK: DW_TAG_variable7; CHECK-NEXT: DW_AT_location8; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value9; SECTIONS-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value10; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +9, DW_OP_stack_value11; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value12; CHECK-NEXT: DW_AT_name ("i")13 14; Source to generate the IR below:15; void f1();16; int f2(int);17; extern bool b;18; extern int x;19; void test() {20; // i's value is 7 for the first call in the if block. With basic21; // block sections, this would split the range across sections and would22; // result in an extra entry than without sections.23; int i = 7;24; f1();25; if (b) {26; f2(i);27; i += 2;28; f2(i);29; }30; }31; $ clang++ -S -emit-llvm -g -O2 loclist_2.cc32;33 34@b = external dso_local local_unnamed_addr global i8, align 135 36define dso_local void @_Z4testv() local_unnamed_addr !dbg !7 {37entry:38 call void @llvm.dbg.value(metadata i32 7, metadata !11, metadata !DIExpression()), !dbg !1339 tail call void @_Z2f1v(), !dbg !1440 %0 = load i8, ptr @b, align 1, !dbg !15, !tbaa !17, !range !2141 %tobool.not = icmp eq i8 %0, 0, !dbg !1542 br i1 %tobool.not, label %if.end, label %if.then, !dbg !2243 44if.then: ; preds = %entry45 %call = tail call i32 @_Z2f2i(i32 7), !dbg !2346 call void @llvm.dbg.value(metadata i32 9, metadata !11, metadata !DIExpression()), !dbg !1347 %call1 = tail call i32 @_Z2f2i(i32 9), !dbg !2548 br label %if.end, !dbg !2649 50if.end: ; preds = %if.then, %entry51 ret void, !dbg !2752}53 54declare !dbg !28 dso_local void @_Z2f1v() local_unnamed_addr55 56declare !dbg !29 dso_local i32 @_Z2f2i(i32) local_unnamed_addr57 58; Function Attrs: nofree nosync nounwind readnone speculatable willreturn59declare void @llvm.dbg.value(metadata, metadata, metadata) #260 61!llvm.dbg.cu = !{!0}62!llvm.module.flags = !{!3, !4, !5}63!llvm.ident = !{!6}64 65!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (git@github.com:llvm/llvm-project.git 593cb4655097552ac6d81ce18a2851ae0feb8d3c)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)66!1 = !DIFile(filename: "loclist_2.cc", directory: "/code")67!2 = !{}68!3 = !{i32 7, !"Dwarf Version", i32 4}69!4 = !{i32 2, !"Debug Info Version", i32 3}70!5 = !{i32 1, !"wchar_size", i32 4}71!6 = !{!"clang version 13.0.0 (git@github.com:llvm/llvm-project.git 593cb4655097552ac6d81ce18a2851ae0feb8d3c)"}72!7 = distinct !DISubprogram(name: "test", linkageName: "_Z4testv", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)73!8 = !DISubroutineType(types: !9)74!9 = !{null}75!10 = !{!11}76!11 = !DILocalVariable(name: "i", scope: !7, file: !1, line: 14, type: !12)77!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)78!13 = !DILocation(line: 0, scope: !7)79!14 = !DILocation(line: 15, column: 5, scope: !7)80!15 = !DILocation(line: 16, column: 9, scope: !16)81!16 = distinct !DILexicalBlock(scope: !7, file: !1, line: 16, column: 9)82!17 = !{!18, !18, i64 0}83!18 = !{!"bool", !19, i64 0}84!19 = !{!"omnipotent char", !20, i64 0}85!20 = !{!"Simple C++ TBAA"}86!21 = !{i8 0, i8 2}87!22 = !DILocation(line: 16, column: 9, scope: !7)88!23 = !DILocation(line: 17, column: 7, scope: !24)89!24 = distinct !DILexicalBlock(scope: !16, file: !1, line: 16, column: 12)90!25 = !DILocation(line: 19, column: 7, scope: !24)91!26 = !DILocation(line: 20, column: 5, scope: !24)92!27 = !DILocation(line: 21, column: 1, scope: !7)93!28 = !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 1, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)94!29 = !DISubprogram(name: "f2", linkageName: "_Z2f2i", scope: !1, file: !1, line: 2, type: !30, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)95!30 = !DISubroutineType(types: !31)96!31 = !{!12, !12}97