Skip to content

Commit cbd6961

Browse files
jayfoadtstellar
authored andcommitted
[AMDGPU] Do not bother adding reserved registers to liveins (llvm#79436)
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the function liveins.
1 parent 01ec407 commit cbd6961

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6890,9 +6890,7 @@ bool AMDGPULegalizerInfo::legalizeWaveID(MachineInstr &MI,
68906890
return false;
68916891
LLT S32 = LLT::scalar(32);
68926892
Register DstReg = MI.getOperand(0).getReg();
6893-
Register TTMP8 =
6894-
getFunctionLiveInPhysReg(B.getMF(), B.getTII(), AMDGPU::TTMP8,
6895-
AMDGPU::SReg_32RegClass, B.getDebugLoc(), S32);
6893+
auto TTMP8 = B.buildCopy(S32, Register(AMDGPU::TTMP8));
68966894
auto LSB = B.buildConstant(S32, 25);
68976895
auto Width = B.buildConstant(S32, 5);
68986896
B.buildUbfx(DstReg, TTMP8, LSB, Width);

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7926,8 +7926,7 @@ SDValue SITargetLowering::lowerWaveID(SelectionDAG &DAG, SDValue Op) const {
79267926
return {};
79277927
SDLoc SL(Op);
79287928
MVT VT = MVT::i32;
7929-
SDValue TTMP8 = CreateLiveInRegister(DAG, &AMDGPU::SReg_32RegClass,
7930-
AMDGPU::TTMP8, VT, SL);
7929+
SDValue TTMP8 = DAG.getCopyFromReg(DAG.getEntryNode(), SL, AMDGPU::TTMP8, VT);
79317930
return DAG.getNode(AMDGPUISD::BFE_U32, SL, VT, TTMP8,
79327931
DAG.getConstant(25, SL, VT), DAG.getConstant(5, SL, VT));
79337932
}

0 commit comments

Comments
 (0)