brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.0 KiB · be0a375 Raw
240 lines · plain
1; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t2; RUN: llvm-dwarfdump -v %t | FileCheck %s3; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s4 5; RUN: llc -dwarf-version=5 -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t6; RUN: llvm-dwarfdump -v %t | FileCheck --check-prefix=V5RNGLISTS %s7 8; RUN: llc -O0 %s -mtriple=x86_64-unknown-linux-gnu -stop-after=livedebugvalues -o - | FileCheck --check-prefix=CHECK-MIR %s9 10; LiveDebugValues should produce DBG_VALUEs for variable "b" in successive11; blocks once we recognize that it is spilled.12; CHECK-MIR: ![[BDIVAR:[0-9]+]] = !DILocalVariable(name: "b"13; CHECK-MIR: DBG_VALUE $rsp, 0, ![[BDIVAR]], !DIExpression(DW_OP_constu, 24, DW_OP_minus)14; CHECK-MIR-LABEL: bb.6.for.inc13:15; CHECK-MIR: DBG_VALUE $rsp, 0, ![[BDIVAR]], !DIExpression(DW_OP_constu, 24, DW_OP_minus)16; CHECK-MIR-LABEL: bb.7.for.inc16:17; CHECK-MIR: DBG_VALUE $rsp, 0, ![[BDIVAR]], !DIExpression(DW_OP_constu, 24, DW_OP_minus)18 19 20; CHECK: .debug_info contents:21; CHECK: DW_TAG_compile_unit22; CHECK-NEXT: DW_AT_stmt_list23; CHECK-NEXT: DW_AT_comp_dir24; CHECK-NEXT: DW_AT_GNU_dwo_name25; CHECK-NEXT: DW_AT_GNU_dwo_id26; CHECK-NEXT: DW_AT_GNU_ranges_base27; CHECK-NEXT: DW_AT_low_pc28; CHECK-NEXT: DW_AT_high_pc29; CHECK-NEXT: DW_AT_GNU_addr_base [DW_FORM_sec_offset]                   (0x00000000)30 31; CHECK: .debug_info.dwo contents:32; CHECK:      DW_TAG_formal_parameter33; CHECK-NEXT:   DW_AT_const_value [DW_FORM_sdata] (1)34; CHECK-NEXT:   DW_AT_name {{.*}} "p")35; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[A:0x[0-9a-z]*]]:36; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[E:0x[0-9a-z]*]]:37; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[B:0x[0-9a-z]*]]:38; CHECK: DW_AT_location [DW_FORM_sec_offset]   ([[D:0x[0-9a-z]*]]:39; CHECK: DW_AT_ranges [DW_FORM_sec_offset]   (0x0000000040; CHECK-NOT: .debug_loc contents:41; CHECK-NOT: Beginning address offset42; CHECK: .debug_loc.dwo contents:43 44; Don't assume these locations are entirely correct - feel free to update them45; if they've changed due to a bugfix, change in register allocation, etc.46 47; CHECK:      [[A]]:48; CHECK-NEXT:   DW_LLE_startx_length (0x00000001, 0x00000011): DW_OP_consts +0, DW_OP_stack_value49; CHECK-NEXT:   DW_LLE_startx_length (0x00000002, 0x0000000b): DW_OP_reg0 RAX50; CHECK-NEXT:   DW_LLE_startx_length (0x00000003, 0x00000012): DW_OP_breg7 RSP-451; CHECK-NEXT:   DW_LLE_end_of_list   ()52; CHECK:      [[E]]:53; CHECK-NEXT:   DW_LLE_startx_length (0x00000004, 0x0000000b): DW_OP_reg0 RAX54; CHECK-NEXT:   DW_LLE_startx_length (0x00000005, 0x0000005a): DW_OP_breg7 RSP-3655; CHECK-NEXT:   DW_LLE_end_of_list   ()56; CHECK:      [[B]]:57; CHECK-NEXT:   DW_LLE_startx_length (0x00000006, 0x0000000b): DW_OP_reg0 RAX58; CHECK-NEXT:   DW_LLE_startx_length (0x00000007, 0x00000042): DW_OP_breg7 RSP-2459; CHECK-NEXT:   DW_LLE_end_of_list   ()60; CHECK:      [[D]]:61; CHECK-NEXT:   DW_LLE_startx_length (0x00000008, 0x0000000b): DW_OP_reg0 RAX62; CHECK-NEXT:   DW_LLE_startx_length (0x00000009, 0x0000002a): DW_OP_breg7 RSP-1263; CHECK-NEXT:   DW_LLE_end_of_list   ()64 65; Make sure we don't produce any relocations in any .dwo section (though in particular, debug_info.dwo)66; HDR-NOT: .rela.{{.*}}.dwo67 68; Make sure we have enough stuff in the debug_addr to cover the address indexes69; (9 is the last index in debug_loc.dwo, making 10 entries of 8 bytes each,70; 10 * 8 == 80 base 10 == 50 base 16)71 72; HDR: .debug_addr 0000005073; HDR-NOT: .rela.{{.*}}.dwo74 75; Check for the existence of a DWARF v5-style range list table in the .debug_rnglists76; section and that the compile unit has a DW_AT_rnglists_base attribute.77; The table should contain at least one rangelist with at least 2 individual ranges.78 79; V5RNGLISTS:      .debug_info contents:80; V5RNGLISTS:      DW_TAG_compile_unit81; V5RNGLISTS-NOT:  DW_TAG82; V5RNGLISTS:      DW_AT_rnglists_base [DW_FORM_sec_offset]  (0x0000000c)83; V5RNGLISTS:      .debug_rnglists contents:84; V5RNGLISTS-NEXT: 0x00000000: range list header: length = 0x00000015, format = DWARF32, version = 0x0005,85; V5RNGLISTS-SAME: addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x0000000186; V5RNGLISTS-NEXT: offsets: [87; V5RNGLISTS-NEXT: => 0x0000001088; V5RNGLISTS-NEXT: ]89; V5RNGLISTS-NEXT: ranges:90; V5RNGLISTS-NEXT: 0x00000010: [DW_RLE_offset_pair]:91; V5RNGLISTS-NEXT: 0x00000013: [DW_RLE_offset_pair]:92; V5RNGLISTS:      0x{{[0-9a-f]+}}: [DW_RLE_end_of_list]93 94; From the code:95 96; extern int c;97; static void foo (int p)98; {99;   int a, b;100;   unsigned int d, e;101 102;   for (a = 0; a < 30; a++)103;     for (d = 0; d < 30; d++)104;       for (b = 0; b < 30; b++)105;         for (e = 0; e < 30; e++)106;           {107;             int *w = &c;108;             *w &= p;109;           }110; }111 112; void113; bar ()114; {115;   foo (1);116; }117 118; compiled with:119 120; clang -g -S -gsplit-dwarf -O1 small.c121 122@c = external dso_local global i32123 124; Function Attrs: nounwind uwtable125define void @bar() #0 !dbg !4 {126entry:127  tail call fastcc void @foo(), !dbg !27128  ret void, !dbg !28129}130 131; Function Attrs: nounwind uwtable132define internal fastcc void @foo() #0 !dbg !8 {133entry:134  tail call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !DIExpression()), !dbg !30135  tail call void @llvm.dbg.value(metadata i32 0, metadata !14, metadata !DIExpression()), !dbg !31136  %c.promoted9 = load i32, ptr @c, align 4, !dbg !32, !tbaa !33137  br label %for.cond1.preheader, !dbg !31138 139for.cond1.preheader:                              ; preds = %for.inc16, %entry140  %and.lcssa.lcssa.lcssa10 = phi i32 [ %c.promoted9, %entry ], [ %and, %for.inc16 ]141  %a.08 = phi i32 [ 0, %entry ], [ %inc17, %for.inc16 ]142  br label %for.cond4.preheader, !dbg !37143 144for.cond4.preheader:                              ; preds = %for.inc13, %for.cond1.preheader145  %and.lcssa.lcssa7 = phi i32 [ %and.lcssa.lcssa.lcssa10, %for.cond1.preheader ], [ %and, %for.inc13 ]146  %d.06 = phi i32 [ 0, %for.cond1.preheader ], [ %inc14, %for.inc13 ]147  br label %for.cond7.preheader, !dbg !38148 149for.cond7.preheader:                              ; preds = %for.inc10, %for.cond4.preheader150  %and.lcssa5 = phi i32 [ %and.lcssa.lcssa7, %for.cond4.preheader ], [ %and, %for.inc10 ]151  %b.03 = phi i32 [ 0, %for.cond4.preheader ], [ %inc11, %for.inc10 ]152  br label %for.body9, !dbg !39153 154for.body9:                                        ; preds = %for.body9, %for.cond7.preheader155  %and2 = phi i32 [ %and.lcssa5, %for.cond7.preheader ], [ %and, %for.body9 ], !dbg !40156  %e.01 = phi i32 [ 0, %for.cond7.preheader ], [ %inc, %for.body9 ]157  tail call void @llvm.dbg.value(metadata ptr @c, metadata !19, metadata !DIExpression()), !dbg !40158  %and = and i32 %and2, 1, !dbg !32159  %inc = add i32 %e.01, 1, !dbg !39160  tail call void @llvm.dbg.value(metadata i32 %inc, metadata !18, metadata !DIExpression()), !dbg !42161  %exitcond = icmp eq i32 %inc, 30, !dbg !39162  br i1 %exitcond, label %for.inc10, label %for.body9, !dbg !39163 164for.inc10:                                        ; preds = %for.body9165  %inc11 = add nsw i32 %b.03, 1, !dbg !38166  tail call void @llvm.dbg.value(metadata i32 %inc11, metadata !15, metadata !DIExpression()), !dbg !42167  %exitcond11 = icmp eq i32 %inc11, 30, !dbg !38168  br i1 %exitcond11, label %for.inc13, label %for.cond7.preheader, !dbg !38169 170for.inc13:                                        ; preds = %for.inc10171  %inc14 = add i32 %d.06, 1, !dbg !37172  tail call void @llvm.dbg.value(metadata i32 %inc14, metadata !16, metadata !DIExpression()), !dbg !42173  %exitcond12 = icmp eq i32 %inc14, 30, !dbg !37174  br i1 %exitcond12, label %for.inc16, label %for.cond4.preheader, !dbg !37175 176for.inc16:                                        ; preds = %for.inc13177  %inc17 = add nsw i32 %a.08, 1, !dbg !31178  tail call void @llvm.dbg.value(metadata i32 %inc17, metadata !14, metadata !DIExpression()), !dbg !31179  %exitcond13 = icmp eq i32 %inc17, 30, !dbg !31180  br i1 %exitcond13, label %for.end18, label %for.cond1.preheader, !dbg !31181 182for.end18:                                        ; preds = %for.inc16183  store i32 %and, ptr @c, align 4, !dbg !32, !tbaa !33184  ret void, !dbg !42185}186 187; Function Attrs: nounwind readnone188declare void @llvm.dbg.value(metadata, metadata, metadata) #1189 190attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }191attributes #1 = { nounwind readnone }192 193!llvm.dbg.cu = !{!0}194!llvm.module.flags = !{!26, !43}195 196!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.4 (trunk 191700) (llvm/trunk 191710)", isOptimized: true, splitDebugFilename: "small.dwo", emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)197!1 = !DIFile(filename: "small.c", directory: "/usr/local/google/home/echristo/tmp")198!2 = !{}199!4 = distinct !DISubprogram(name: "bar", line: 18, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 19, file: !1, scope: !5, type: !6, retainedNodes: !2)200!5 = !DIFile(filename: "small.c", directory: "/usr/local/google/home/echristo/tmp")201!6 = !DISubroutineType(types: !7)202!7 = !{null}203!8 = distinct !DISubprogram(name: "foo", line: 2, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !9, retainedNodes: !12)204!9 = !DISubroutineType(types: !10)205!10 = !{null, !11}206!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)207!12 = !{!13, !14, !15, !16, !18, !19}208!13 = !DILocalVariable(name: "p", line: 2, arg: 1, scope: !8, file: !5, type: !11)209!14 = !DILocalVariable(name: "a", line: 4, scope: !8, file: !5, type: !11)210!15 = !DILocalVariable(name: "b", line: 4, scope: !8, file: !5, type: !11)211!16 = !DILocalVariable(name: "d", line: 5, scope: !8, file: !5, type: !17)212!17 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)213!18 = !DILocalVariable(name: "e", line: 5, scope: !8, file: !5, type: !17)214!19 = !DILocalVariable(name: "w", line: 12, scope: !20, file: !5, type: !25)215!20 = distinct !DILexicalBlock(line: 11, column: 0, file: !1, scope: !21)216!21 = distinct !DILexicalBlock(line: 10, column: 0, file: !1, scope: !22)217!22 = distinct !DILexicalBlock(line: 9, column: 0, file: !1, scope: !23)218!23 = distinct !DILexicalBlock(line: 8, column: 0, file: !1, scope: !24)219!24 = distinct !DILexicalBlock(line: 7, column: 0, file: !1, scope: !8)220!25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !11)221!26 = !{i32 2, !"Dwarf Version", i32 4}222!27 = !DILocation(line: 20, scope: !4)223!28 = !DILocation(line: 21, scope: !4)224!29 = !{i32 1}225!30 = !DILocation(line: 2, scope: !8)226!31 = !DILocation(line: 7, scope: !24)227!32 = !DILocation(line: 13, scope: !20)228!33 = !{!34, !34, i64 0}229!34 = !{!"int", !35, i64 0}230!35 = !{!"omnipotent char", !36, i64 0}231!36 = !{!"Simple C/C++ TBAA"}232!37 = !DILocation(line: 8, scope: !23)233!38 = !DILocation(line: 9, scope: !22)234!39 = !DILocation(line: 10, scope: !21)235!40 = !DILocation(line: 12, scope: !20)236!41 = !{ptr @c}237!42 = !DILocation(line: 15, scope: !8)238!43 = !{i32 1, !"Debug Info Version", i32 3}239!44 = !{i32 0}240