Skip to content

Commit 6cc91ad

Browse files
committed
[AMDGPU] Kill temporary register after restoring
Not a correctness issue, but the temporary register is not used afterwards and should be dead. Differential Revision: https://reviews.llvm.org/D100295
1 parent f2593a0 commit 6cc91ad

File tree

4 files changed

+394
-394
lines changed

4 files changed

+394
-394
lines changed

llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,15 @@ struct SGPRSpillBuilder {
228228
// Add an implicit use of the load so it is not dead.
229229
// FIXME This inserts an unnecessary waitcnt
230230
if (!TmpVGPRLive) {
231-
I.addReg(TmpVGPR, RegState::Implicit);
231+
I.addReg(TmpVGPR, RegState::ImplicitKill);
232232
}
233233
} else {
234234
// Restore inactive lanes
235235
TRI.buildVGPRSpillLoadStore(*this, TmpVGPRIndex, 0, /*IsLoad*/ true,
236236
/*IsKill*/ false);
237237
auto I = BuildMI(MBB, MI, DL, TII.get(NotOpc), ExecReg).addReg(ExecReg);
238238
if (!TmpVGPRLive) {
239-
I.addReg(TmpVGPR, RegState::Implicit);
239+
I.addReg(TmpVGPR, RegState::ImplicitKill);
240240
}
241241
// Restore active lanes
242242
if (TmpVGPRLive)

llvm/test/CodeGen/AMDGPU/frame-setup-without-sgpr-to-vgpr-spills.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ define void @callee_with_stack_and_call() #0 {
6060
; NO-SPILL-TO-VGPR-NEXT: s_swappc_b64 s[30:31], s[4:5]
6161
; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 s[6:7], exec
6262
; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, 3
63-
; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v2, off, s[0:3], s33 offset:16
64-
; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v2, off, s[0:3], s33 offset:4 ; 4-byte Folded Reload
63+
; NO-SPILL-TO-VGPR-NEXT: buffer_store_dword v1, off, s[0:3], s33 offset:16
64+
; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v1, off, s[0:3], s33 offset:4 ; 4-byte Folded Reload
6565
; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
66-
; NO-SPILL-TO-VGPR-NEXT: v_readlane_b32 s4, v2, 0
67-
; NO-SPILL-TO-VGPR-NEXT: v_readlane_b32 s5, v2, 1
68-
; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v2, off, s[0:3], s33 offset:16
66+
; NO-SPILL-TO-VGPR-NEXT: v_readlane_b32 s4, v1, 0
67+
; NO-SPILL-TO-VGPR-NEXT: v_readlane_b32 s5, v1, 1
68+
; NO-SPILL-TO-VGPR-NEXT: buffer_load_dword v1, off, s[0:3], s33 offset:16
6969
; NO-SPILL-TO-VGPR-NEXT: s_waitcnt vmcnt(0)
7070
; NO-SPILL-TO-VGPR-NEXT: s_mov_b64 exec, s[6:7]
7171
; NO-SPILL-TO-VGPR-NEXT: s_sub_u32 s32, s32, 0x800

0 commit comments

Comments
 (0)