brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.9 KiB · 00fc85c Raw
100 lines · plain
1; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=none -filetype=obj -o - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s2; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=4 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=true | 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 - -experimental-debug-variable-locations=true | llvm-dwarfdump - | FileCheck %s4; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu --dwarf-version=5 --basic-block-sections=all -filetype=obj -o - -experimental-debug-variable-locations=true | 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; SECTIONS-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_consts +7, DW_OP_stack_value11; CHECK-NEXT: [0x{{[0-9a-f]+}}, 0x{{[0-9a-f]+}}): DW_OP_reg0 RAX)12; CHECK-NEXT: DW_AT_name	("i")13 14; In the test below, i's constant value of 7 is only valid partially as15; it is redefined at the end.  This forces the use of a loclist with basic16; block sections.  Without basic block sections, a single entry location17; list would be used to mark the entire scope in which value of i is 7.18 19; Source to generate the IR below:20 21; void f1();22; int f2();23; extern bool b;24; extern int x;25; void test() {26;   int i = 7;27;   f1();28;   if (b)29;     f1();30;   i = f2();31;   f1();32; }33;34; $ clang++ -S -emit-llvm -g -O2 loclist_4.cc35 36 37@b = external dso_local local_unnamed_addr global i8, align 138 39define dso_local void @_Z4testv() local_unnamed_addr !dbg !7 {40entry:41  call void @llvm.dbg.value(metadata i32 7, metadata !11, metadata !DIExpression()), !dbg !1342  tail call void @_Z2f1v(), !dbg !1443  %0 = load i8, ptr @b, align 1, !dbg !15, !tbaa !17, !range !2144  %tobool.not = icmp eq i8 %0, 0, !dbg !1545  br i1 %tobool.not, label %if.end, label %if.then, !dbg !2246 47if.then:                                          ; preds = %entry48  tail call void @_Z2f1v(), !dbg !2349  br label %if.end, !dbg !2350 51if.end:                                           ; preds = %if.then, %entry52  %call = tail call i32 @_Z2f2v(), !dbg !2453  call void @llvm.dbg.value(metadata i32 %call, metadata !11, metadata !DIExpression()), !dbg !1354  tail call void @_Z2f1v(), !dbg !2555  ret void, !dbg !2656}57 58declare !dbg !27 dso_local void @_Z2f1v() local_unnamed_addr59 60declare !dbg !28 dso_local i32 @_Z2f2v() local_unnamed_addr61 62; Function Attrs: nofree nosync nounwind readnone speculatable willreturn63declare void @llvm.dbg.value(metadata, metadata, metadata)64 65!llvm.dbg.cu = !{!0}66!llvm.module.flags = !{!3, !4, !5}67!llvm.ident = !{!6}68 69!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)70!1 = !DIFile(filename: "loclist_5.cc", directory: "/code")71!2 = !{}72!3 = !{i32 7, !"Dwarf Version", i32 4}73!4 = !{i32 2, !"Debug Info Version", i32 3}74!5 = !{i32 1, !"wchar_size", i32 4}75!6 = !{!"clang version 13.0.0 (git@github.com:llvm/llvm-project.git 593cb4655097552ac6d81ce18a2851ae0feb8d3c)"}76!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)77!8 = !DISubroutineType(types: !9)78!9 = !{null}79!10 = !{!11}80!11 = !DILocalVariable(name: "i", scope: !7, file: !1, line: 9, type: !12)81!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)82!13 = !DILocation(line: 0, scope: !7)83!14 = !DILocation(line: 10, column: 3, scope: !7)84!15 = !DILocation(line: 11, column: 7, scope: !16)85!16 = distinct !DILexicalBlock(scope: !7, file: !1, line: 11, column: 7)86!17 = !{!18, !18, i64 0}87!18 = !{!"bool", !19, i64 0}88!19 = !{!"omnipotent char", !20, i64 0}89!20 = !{!"Simple C++ TBAA"}90!21 = !{i8 0, i8 2}91!22 = !DILocation(line: 11, column: 7, scope: !7)92!23 = !DILocation(line: 12, column: 5, scope: !16)93!24 = !DILocation(line: 13, column: 7, scope: !7)94!25 = !DILocation(line: 14, column: 3, scope: !7)95!26 = !DILocation(line: 15, column: 1, scope: !7)96!27 = !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 1, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)97!28 = !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !29, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)98!29 = !DISubroutineType(types: !30)99!30 = !{!12}100