Skip to content

Commit

Permalink
[AMDGPU] When allocating VGPRs, VGPR spills are not part of the prolo…
Browse files Browse the repository at this point in the history
…gue (llvm#109439)

PRs llvm#69924 and llvm#72140 modified SIInstrInfo::isBasicBlockPrologue to skip
over EXEC modifications and spills when allocating VGPRs. But treating
VGPR spills as part of the prologue can confuse the register allocator
as in llvm#109294, so restrict it to SGPR spills, which were inserted during
SGPR allocation which is done in an earlier pass.

Fixes: llvm#109294
Fixes: SWDEV-485841
  • Loading branch information
jayfoad authored Sep 30, 2024
1 parent c0e97c4 commit 735a5f6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8899,11 +8899,10 @@ bool SIInstrInfo::isBasicBlockPrologue(const MachineInstr &MI,
}

uint16_t Opcode = MI.getOpcode();
// FIXME: Copies inserted in the block prolog for live-range split should also
// be included.
return IsNullOrVectorRegister &&
(isSpill(Opcode) || (!MI.isTerminator() && Opcode != AMDGPU::COPY &&
MI.modifiesRegister(AMDGPU::EXEC, &RI)));
(isSGPRSpill(Opcode) ||
(!MI.isTerminator() && Opcode != AMDGPU::COPY &&
MI.modifiesRegister(AMDGPU::EXEC, &RI)));
}

MachineInstrBuilder
Expand Down

0 comments on commit 735a5f6

Please sign in to comment.