Skip to content

Commit

Permalink
[AMDGPU] Do not bother adding reserved registers to liveins (#79436)
Browse files Browse the repository at this point in the history
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the
function liveins.
  • Loading branch information
jayfoad authored and tstellar committed Jan 29, 2024
1 parent 4c8cf4a commit 824a3e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6890,9 +6890,7 @@ bool AMDGPULegalizerInfo::legalizeWaveID(MachineInstr &MI,
return false;
LLT S32 = LLT::scalar(32);
Register DstReg = MI.getOperand(0).getReg();
Register TTMP8 =
getFunctionLiveInPhysReg(B.getMF(), B.getTII(), AMDGPU::TTMP8,
AMDGPU::SReg_32RegClass, B.getDebugLoc(), S32);
auto TTMP8 = B.buildCopy(S32, Register(AMDGPU::TTMP8));
auto LSB = B.buildConstant(S32, 25);
auto Width = B.buildConstant(S32, 5);
B.buildUbfx(DstReg, TTMP8, LSB, Width);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7926,8 +7926,7 @@ SDValue SITargetLowering::lowerWaveID(SelectionDAG &DAG, SDValue Op) const {
return {};
SDLoc SL(Op);
MVT VT = MVT::i32;
SDValue TTMP8 = CreateLiveInRegister(DAG, &AMDGPU::SReg_32RegClass,
AMDGPU::TTMP8, VT, SL);
SDValue TTMP8 = DAG.getCopyFromReg(DAG.getEntryNode(), SL, AMDGPU::TTMP8, VT);
return DAG.getNode(AMDGPUISD::BFE_U32, SL, VT, TTMP8,
DAG.getConstant(25, SL, VT), DAG.getConstant(5, SL, VT));
}
Expand Down

0 comments on commit 824a3e5

Please sign in to comment.