xref: /llvm-project/llvm/test/CodeGen/AMDGPU/sgpr-spill-fi-skip-processing-stack-arg-dbg-value.mir (revision 0b0874755d4f339ae3ef6a43421405ebe9d645f3)
1# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -amdgpu-spill-sgpr-to-vgpr=true -verify-machineinstrs -run-pass=si-lower-sgpr-spills -o - %s | FileCheck %s
2# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -amdgpu-spill-sgpr-to-vgpr=true -passes=si-lower-sgpr-spills -o - %s | FileCheck %s
3
4# After handling the SGPR spill to VGPR in SILowerSGPRSpills pass, we replace the dead frame index in the DBG_VALUE instruction with reg 0.
5# Skip looking for frame indices in the debug value instruction for incoming arguments passed via stack. The test would crash otherwise.
6# It is safe to skip the fixed stack objects as they will never become the spill objects.
7
8--- |
9  define amdgpu_kernel void @test() { ret void }
10
11  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !4, producer: "llvm", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4)
12  !1 = !DILocalVariable(name: "a", scope: !2, file: !4, line: 126, type: !6)
13  !2 = distinct !DISubprogram(name: "test", scope: !4, file: !4, line: 1, type: !3, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !5)
14  !3 = !DISubroutineType(types: !4)
15  !4 = !{null}
16  !5 = !{!1}
17  !6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64, align: 32)
18  !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
19  !8 = !DIExpression()
20  !9 = !DILocation(line: 10, column: 9, scope: !2)
21
22...
23---
24name:            test
25tracksRegLiveness: true
26frameInfo:
27  maxAlignment:    4
28fixedStack:
29  - { id: 0, type: default, offset: 4, size: 4, alignment: 4, stack-id: default }
30stack:
31  - { id: 0, type: spill-slot, size: 4, alignment: 4, stack-id: sgpr-spill }
32machineFunctionInfo:
33  maxKernArgAlign: 4
34  isEntryFunction: true
35  waveLimiter:     true
36  scratchRSrcReg:  '$sgpr96_sgpr97_sgpr98_sgpr99'
37  stackPtrOffsetReg: '$sgpr32'
38  frameOffsetReg: '$sgpr33'
39  hasSpilledSGPRs: true
40  argumentInfo:
41    privateSegmentBuffer: { reg: '$sgpr0_sgpr1_sgpr2_sgpr3' }
42    dispatchPtr:     { reg: '$sgpr4_sgpr5' }
43    kernargSegmentPtr: { reg: '$sgpr6_sgpr7' }
44    workGroupIDX:    { reg: '$sgpr8' }
45    privateSegmentWaveByteOffset: { reg: '$sgpr9' }
46body:             |
47  ; CHECK-LABEL: name: test
48  ; CHECK: bb.0:
49  ; CHECK:   DBG_VALUE
50  bb.0:
51    renamable $sgpr10 = IMPLICIT_DEF
52    SI_SPILL_S32_SAVE killed $sgpr10, %stack.0, implicit $exec, implicit $sgpr96_sgpr97_sgpr98_sgpr99, implicit $sgpr32
53    DBG_VALUE %fixed-stack.0, 0, !1, !8, debug-location !9
54
55  bb.1:
56    renamable $sgpr10 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sgpr96_sgpr97_sgpr98_sgpr99, implicit $sgpr32
57    S_ENDPGM 0
58