Skip to content

Commit 3bd28c1

Browse files
committed
Add test and debug message
1 parent f910dd2 commit 3bd28c1

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,6 +3734,15 @@ bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF,
37343734
VTracker = nullptr;
37353735
TTracker = nullptr;
37363736

3737+
if (MTracker->NumSlotIdxes >= StackSlotIdxesLimit) {
3738+
LLVM_DEBUG(
3739+
dbgs() << "Disabling InstrRefBasedLDV spill tracking for "
3740+
<< MF.getName()
3741+
<< " since target has too many potential stack slot indexes ("
3742+
<< MTracker->NumSlotIdxes << ", limit is " << StackSlotIdxesLimit
3743+
<< ")\n");
3744+
}
3745+
37373746
SmallVector<MLocTransferMap, 32> MLocTransfer;
37383747
SmallVector<VLocTracker, 8> vlocs;
37393748
LiveInsT SavedLiveIns;
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
2+
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -run-pass livedebugvalues %s -o - -debug-only livedebugvalues 2>&1 | FileCheck %s
3+
4+
# Verify that spill tracking is disabled on amdgcn.
5+
6+
# CHECK: Disabling InstrRefBasedLDV spill tracking for kern since target has too many potential stack slot indexes
7+
8+
--- |
9+
define void @kern() #0 !dbg !9 {
10+
ret void, !dbg !15
11+
}
12+
13+
attributes #0 = { noinline nounwind optnone "target-cpu"="gfx1100" }
14+
15+
!llvm.dbg.cu = !{!0}
16+
!llvm.module.flags = !{!2, !3, !4, !5, !6, !7}
17+
!llvm.ident = !{!8}
18+
19+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 19.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
20+
!1 = !DIFile(filename: "t.cpp", directory: "/")
21+
!2 = !{i32 1, !"amdhsa_code_object_version", i32 500}
22+
!3 = !{i32 7, !"Dwarf Version", i32 5}
23+
!4 = !{i32 2, !"Debug Info Version", i32 3}
24+
!5 = !{i32 1, !"wchar_size", i32 4}
25+
!6 = !{i32 8, !"PIC Level", i32 2}
26+
!7 = !{i32 7, !"frame-pointer", i32 2}
27+
!8 = !{!"clang version 19.0.0"}
28+
!9 = distinct !DISubprogram(name: "kern", linkageName: "kern", scope: !1, file: !1, line: 1, type: !10, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12)
29+
!10 = !DISubroutineType(types: !11)
30+
!11 = !{}
31+
!12 = !{!13}
32+
!13 = !DILocalVariable(name: "var", scope: !9, file: !1, line: 1, type: !14)
33+
!14 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed)
34+
!15 = !DILocation(line: 1, column: 1, scope: !9)
35+
36+
...
37+
---
38+
name: kern
39+
tracksRegLiveness: true
40+
debugInstrRef: true
41+
stack:
42+
- { id: 0, name: '', type: spill-slot, offset: 0, size: 4, alignment: 4 }
43+
machineFunctionInfo:
44+
scratchRSrcReg: $sgpr0_sgpr1_sgpr2_sgpr3
45+
stackPtrOffsetReg: '$sgpr32'
46+
hasSpilledVGPRs: true
47+
body: |
48+
bb.0:
49+
; CHECK-LABEL: name: kern
50+
; CHECK: frame-setup CFI_INSTRUCTION escape 0x0f, 0x09, 0x90, 0x40, 0x94, 0x04, 0x36, 0x24, 0x36, 0xe9, 0x02
51+
; CHECK-NEXT: frame-setup CFI_INSTRUCTION llvm_register_pair $pc_reg, $sgpr30, 32, $sgpr31, 32
52+
; CHECK-NEXT: frame-setup CFI_INSTRUCTION undefined $vgpr0
53+
; CHECK-NEXT: DBG_INSTR_REF !13, !DIExpression(DIOpArg(0, i32)), dbg-instr-ref(1, 0), debug-location !15
54+
; CHECK-NEXT: DBG_VALUE_LIST !13, !DIExpression(DIOpArg(0, i32)), $noreg, debug-location !15
55+
; CHECK-NEXT: $vgpr0 = V_MOV_B32_e32 0, implicit $exec, debug-instr-number 1, debug-location !15
56+
; CHECK-NEXT: DBG_VALUE_LIST !13, !DIExpression(DIOpArg(0, i32)), $vgpr0, debug-location !15
57+
; CHECK-NEXT: SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr32, 0, 0, implicit $exec, implicit $flat_scr, debug-location !15 :: (store (s32) into %stack.0, addrspace 5)
58+
; CHECK-NEXT: S_NOP 0, debug-location !15
59+
; CHECK-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 0, 0, implicit $exec, implicit $flat_scr, debug-location !15 :: (load (s32) from %stack.0, addrspace 5)
60+
; CHECK-NEXT: S_ENDPGM 0, debug-location !15
61+
frame-setup CFI_INSTRUCTION escape 0x0f, 0x09, 0x90, 0x40, 0x94, 0x04, 0x36, 0x24, 0x36, 0xe9, 0x02
62+
frame-setup CFI_INSTRUCTION llvm_register_pair $pc_reg, $sgpr30, 32, $sgpr31, 32
63+
frame-setup CFI_INSTRUCTION undefined $vgpr0
64+
DBG_INSTR_REF !13, !DIExpression(DIOpArg(0, i32)), dbg-instr-ref(1, 0), debug-location !15
65+
$vgpr0 = V_MOV_B32_e32 0, implicit $exec, debug-instr-number 1, debug-location !15
66+
SCRATCH_STORE_DWORD_SADDR killed $vgpr0, $sgpr32, 0, 0, implicit $exec, implicit $flat_scr, debug-location !15 :: (store (s32) into %stack.0, addrspace 5)
67+
S_NOP 0, debug-location !15
68+
$vgpr0 = SCRATCH_LOAD_DWORD_SADDR $sgpr32, 0, 0, implicit $exec, implicit $flat_scr, debug-location !15 :: (load (s32) from %stack.0, addrspace 5)
69+
S_ENDPGM 0, debug-location !15
70+
71+
...

0 commit comments

Comments
 (0)