-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AMDGPU] Do not bother adding reserved registers to liveins #79436
Conversation
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the function liveins.
@llvm/pr-subscribers-backend-amdgpu Author: Jay Foad (jayfoad) ChangesTweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the Full diff: https://github.com/llvm/llvm-project/pull/79436.diff 2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
index e98ede88a7e2db9..753c2f70f63fe4b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
@@ -6890,11 +6890,9 @@ 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 LSB = B.buildConstant(S32, 25);
auto Width = B.buildConstant(S32, 5);
+ auto TTMP8 = B.buildCopy(S32, Register(AMDGPU::TTMP8));
B.buildUbfx(DstReg, TTMP8, LSB, Width);
MI.eraseFromParent();
return true;
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 4cf9cafedf28fea..ae0f0605a4a338a 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -7927,8 +7927,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));
}
|
auto LSB = B.buildConstant(S32, 25); | ||
auto Width = B.buildConstant(S32, 5); | ||
auto TTMP8 = B.buildCopy(S32, Register(AMDGPU::TTMP8)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will build the copy here instead of in the entry block, and will create a new one for each use of the intrinsic. Is that OK?
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the function liveins.
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the function liveins.
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the function liveins.
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the function liveins.
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the function liveins.
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the function liveins.
Tweak the implementation of llvm.amdgcn.wave.id to not add TTMP8 to the
function liveins.