brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · 72fc4db Raw
115 lines · plain
1; RUN: llc %s --filetype=obj -o - --dwarf-use-key-instructions \2; RUN: | llvm-objdump -d - --no-show-raw-insn \3; RUN: | FileCheck %s --check-prefix=OBJ4 5; RUN: llc %s --filetype=obj -o - --dwarf-use-key-instructions \6; RUN: | llvm-dwarfdump - --debug-line \7; RUN: | FileCheck %s --check-prefix=DBG8 9; OBJ:0000000000000000 <fun>:10; OBJ-NEXT:  0:       pushq   %rbp11; OBJ-NEXT:  1:       pushq   %r1412; OBJ-NEXT:  3:       pushq   %rbx13; OBJ-NEXT:  4:       movq    (%rip), %rax14; OBJ-NEXT:  b:       movl    (%rax), %ebp15; OBJ-NEXT:  d:       callq   0x12 <fun+0x12>16; OBJ-NEXT: 12:       callq   0x17 <fun+0x17>17; OBJ-NEXT: 17:       movl    %eax, %ebx18; OBJ-NEXT: 19:       addl    %ebp, %ebx19; OBJ-NEXT: 1b:       movq    (%rip), %r1420; OBJ-NEXT: 22:       movl    $0x1, (%r14)21; OBJ-NEXT: 29:       callq   0x2e <fun+0x2e>22; OBJ-NEXT: 2e:       movl    $0x2, (%r14)23; OBJ-NEXT: 35:       callq   0x3a <fun+0x3a>24; OBJ-NEXT: 3a:       movl    $0x3, (%r14)25; OBJ-NEXT: 41:       callq   0x46 <fun+0x46>26; OBJ-NEXT: 46:       movl    $0x4, (%r14)27; OBJ-NEXT: 4d:       callq   0x52 <fun+0x52>28; OBJ-NEXT: 52:       movl    %ebx, %eax29; OBJ-NEXT: 54:       popq    %rbx30; OBJ-NEXT: 55:       popq    %r1431; OBJ-NEXT: 57:       popq    %rbp32; OBJ-NEXT: 58:       retq33 34; DBG:      Address            Line   Column File   ISA Discriminator OpIndex Flags35; DBG-NEXT: ------------------ ------ ------ ------ --- ------------- ------- -------------36; DBG-NEXT: 0x0000000000000000      1      0      0   0             0       0  is_stmt37; DBG-NEXT: 0x0000000000000004      2      0      0   0             0       0  is_stmt prologue_end38 39;; Test A:40;; Check the 1st call (line 3) gets is_stmt despite having no atom group.41; DBG-NEXT: 0x000000000000000d      3      0      0   0             0       0  is_stmt42 43;; Test B:44;; Check the 2nd call (line 4) gets is_stmt applied despite being part of group45;; 1 and having lower precedence than the add. Check that the add stil gets46;; is_stmt applied.47;; There are two is_stmt line 4 entries because we don't float48;; is_stmts up on the same line past other key instructions. The call is49;; key, so the add's is_stmt floats up to the movl on the same line, but50;; not past the call.51; DBG-NEXT: 0x0000000000000012      4      0      0   0             0       0  is_stmt52; DBG-NEXT: 0x0000000000000017      4      0      0   0             0       0  is_stmt53 54;; Test C:55;; Check that is_stmt floats up from the call (0x29) to the store (0x1b).56; DBG-NEXT: 0x000000000000001b      5      0      0   0             0       0  is_stmt57 58;; Test D:59;; Check the is_stmt is not applied to the lower ranking instruction (0x2e).60; DBG-NEXT: 0x000000000000002e      6      0      0   0             0       061; DBG-NEXT: 0x0000000000000035      7      0      0   0             0       0  is_stmt62 63;; Test E:64;; Check the is_stmt floats up to an instruction in the same group of the same65;; or lower precedence (from call, 0x41, to `store 3`, 0x3a).66; DBG-NEXT: 0x000000000000003a      8      0      0   0             0       0  is_stmt67; DBG-NEXT: 0x0000000000000046      9      0      0   0             0       0  is_stmt68 69; DBG-NEXT: 0x0000000000000052     10      0      0   0             0       070; DBG-NEXT: 0x0000000000000054     10      0      0   0             0       0  epilogue_begin71; DBG-NEXT: 0x0000000000000059     10      0      0   0             0       0  end_sequence72 73target triple = "x86_64-unknown-linux-gnu"74 75@a = global i32 076@z = global i32 077 78define hidden i32 @fun() local_unnamed_addr !dbg !11 {79entry:80  %b = load i32, ptr @a,   !dbg !DILocation(line: 2, scope: !11)81;; Test A:82  tail call void @f(),     !dbg !DILocation(line: 3, scope: !11)83;; Test B:84  %x = tail call i32 @g(), !dbg !DILocation(line: 4, scope: !11, atomGroup: 1, atomRank: 2)85  %y = add i32 %x, %b,     !dbg !DILocation(line: 4, scope: !11, atomGroup: 1, atomRank: 1)86;; Test C:87  store i32 1, ptr @z,     !dbg !DILocation(line: 5, scope: !11, atomGroup: 2, atomRank: 2)88  tail call void @f(),     !dbg !DILocation(line: 5, scope: !11, atomGroup: 2, atomRank: 1)89;; Test D:90  store i32 2, ptr @z,     !dbg !DILocation(line: 6, scope: !11, atomGroup: 3, atomRank: 2)91  tail call void @f(),     !dbg !DILocation(line: 7, scope: !11, atomGroup: 3, atomRank: 1)92;; Test E:93  store i32 3, ptr @z,     !dbg !DILocation(line: 8, scope: !11, atomGroup: 4, atomRank: 2)94  tail call void @f(),     !dbg !DILocation(line: 8, scope: !11, atomGroup: 4, atomRank: 1)95  store i32 4, ptr @z,     !dbg !DILocation(line: 9, scope: !11, atomGroup: 5, atomRank: 1)96  tail call void @f(),     !dbg !DILocation(line: 9, scope: !11, atomGroup: 5, atomRank: 1)97  ret i32 %y,              !dbg !DILocation(line: 10, scope: !11)98}99 100declare void @f() local_unnamed_addr101declare i32  @g() local_unnamed_addr102 103!llvm.dbg.cu = !{!0}104!llvm.module.flags = !{!2, !3}105!llvm.ident = !{!10}106 107!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_17, file: !1, producer: "clang version 19.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, nameTableKind: None)108!1 = !DIFile(filename: "test.cpp", directory: "/")109!2 = !{i32 7, !"Dwarf Version", i32 5}110!3 = !{i32 2, !"Debug Info Version", i32 3}111!10 = !{!"clang version 19.0.0"}112!11 = distinct !DISubprogram(name: "fun", scope: !1, file: !1, line: 1, type: !12, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, keyInstructions: true)113!12 = !DISubroutineType(types: !13)114!13 = !{}115