Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 8e51b74

Browse files
committed
[AMDGPU] Mark V_SET_INACTIVE operands as unspillable.
This is a quick fix to prevent reloads of operands in WWM regions. Change-Id: Iaadf2b82cd00834901d62880e2e7e7cd37911459
1 parent c976802 commit 8e51b74

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

llvm/lib/Target/AMDGPU/SIPreAllocateWWMRegs.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,16 @@ bool SIPreAllocateWWMRegs::runOnMachineFunction(MachineFunction &MF) {
376376
if (AllowRealloc && MI.isCall())
377377
CallIndexes.insert(LIS->getInstructionIndex(MI));
378378

379-
if (MI.getOpcode() == AMDGPU::V_SET_INACTIVE_B32)
379+
if (MI.getOpcode() == AMDGPU::V_SET_INACTIVE_B32) {
380380
RegsAssigned |= processDef(MI.getOperand(0), false);
381+
// Prevent unexpected reload of operands in WWM region
382+
auto markUnspillable = [&](MachineOperand &Op) {
383+
if (Op.isReg() && Op.getReg().isVirtual())
384+
LIS->getInterval(Op.getReg()).markNotSpillable();
385+
};
386+
markUnspillable(MI.getOperand(2));
387+
markUnspillable(MI.getOperand(4));
388+
}
381389

382390
if (MI.getOpcode() == AMDGPU::SI_SPILL_S32_TO_VGPR) {
383391
if (!PreallocateSGPRSpillVGPRs)

0 commit comments

Comments
 (0)