[llvm] [KeyInstr][DwarfDebug] Add is_stmt emission support (PR #133495)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Fri May 9 04:07:44 PDT 2025
================
@@ -0,0 +1,117 @@
+; RUN: llc %s --filetype=obj -o - --dwarf-use-key-instructions \
+; RUN: | llvm-objdump -d - --no-show-raw-insn \
+; RUN: | FileCheck %s --check-prefix=OBJ
+
+; RUN: llc %s --filetype=obj -o - --dwarf-use-key-instructions \
+; RUN: | llvm-dwarfdump - --debug-line \
+; RUN: | FileCheck %s --check-prefix=DBG
+
+; OBJ:0000000000000000 <fun>:
+; OBJ-NEXT: 0: pushq %rbp
+; OBJ-NEXT: 1: pushq %r14
+; OBJ-NEXT: 3: pushq %rbx
+; OBJ-NEXT: 4: movq (%rip), %rax
+; OBJ-NEXT: b: movl (%rax), %ebp
+; OBJ-NEXT: d: callq 0x12 <fun+0x12>
+; OBJ-NEXT: 12: callq 0x17 <fun+0x17>
+; OBJ-NEXT: 17: movl %eax, %ebx
+; OBJ-NEXT: 19: addl %ebp, %ebx
+; OBJ-NEXT: 1b: movq (%rip), %r14
+; OBJ-NEXT: 22: movl $0x1, (%r14)
+; OBJ-NEXT: 29: callq 0x2e <fun+0x2e>
+; OBJ-NEXT: 2e: movl $0x2, (%r14)
+; OBJ-NEXT: 35: callq 0x3a <fun+0x3a>
+; OBJ-NEXT: 3a: movl $0x3, (%r14)
+; OBJ-NEXT: 41: callq 0x46 <fun+0x46>
+; OBJ-NEXT: 46: movl $0x4, (%r14)
+; OBJ-NEXT: 4d: callq 0x52 <fun+0x52>
+; OBJ-NEXT: 52: movl %ebx, %eax
+; OBJ-NEXT: 54: popq %rbx
+; OBJ-NEXT: 55: popq %r14
+; OBJ-NEXT: 57: popq %rbp
+; OBJ-NEXT: 58: retq
+
+; DBG: Address Line Column File ISA Discriminator OpIndex Flags
+; DBG-NEXT: ------------------ ------ ------ ------ --- ------------- ------- -------------
+; DBG-NEXT: 0x0000000000000000 1 0 0 0 0 0 is_stmt
+; DBG-NEXT: 0x0000000000000004 2 0 0 0 0 0 is_stmt prologue_end
+
+;; Test A:
+;; Check the 1st call (line 3) gets is_stmt despite having no atom group.
+; DBG-NEXT: 0x000000000000000d 3 0 0 0 0 0 is_stmt
+
+;; Test B:
+;; Check the 2nd call (line 4) gets is_stmt applied despite being part of group
+;; 1 and having lower precedence than the add. Check that the add stil gets
+;; is_stmt applied.
+;; There are two is_stmt line 4 entries are is_stmt because we don't float
----------------
OCHyams wrote:
done
https://github.com/llvm/llvm-project/pull/133495
More information about the llvm-commits
mailing list