[llvm] 2e64ad9 - [AMDGPU] Fixed isLegalRegOperand() with physregs
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 11:33:43 PDT 2020
Author: Stanislav Mekhanoshin
Date: 2020-10-23T11:33:34-07:00
New Revision: 2e64ad94948763a4f9a289265dbce4ce1d22591b
URL: https://github.com/llvm/llvm-project/commit/2e64ad94948763a4f9a289265dbce4ce1d22591b
DIFF: https://github.com/llvm/llvm-project/commit/2e64ad94948763a4f9a289265dbce4ce1d22591b.diff
LOG: [AMDGPU] Fixed isLegalRegOperand() with physregs
This does not change anything at the moment, but needed for
D89170. In that change I am probing a physical SGPR to see if
it is legal. RC is SReg_32, but DRC for scratch instructions
is SReg_32_XEXEC_HI and test fails.
That is sufficient just to check if DRC contains a register
here in case of physreg. Physregs also do not use subregs
so the subreg handling below is irrelevant for these.
Differential Revision: https://reviews.llvm.org/D90064
Added:
Modified:
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index db6b8ec44019..21e108ea754a 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -4303,10 +4303,13 @@ bool SIInstrInfo::isLegalRegOperand(const MachineRegisterInfo &MRI,
return false;
Register Reg = MO.getReg();
- const TargetRegisterClass *RC =
- Reg.isVirtual() ? MRI.getRegClass(Reg) : RI.getPhysRegClass(Reg);
const TargetRegisterClass *DRC = RI.getRegClass(OpInfo.RegClass);
+ if (Reg.isPhysical())
+ return DRC->contains(Reg);
+
+ const TargetRegisterClass *RC = MRI.getRegClass(Reg);
+
if (MO.getSubReg()) {
const MachineFunction *MF = MO.getParent()->getParent()->getParent();
const TargetRegisterClass *SuperRC = RI.getLargestLegalSuperClass(RC, *MF);
More information about the llvm-commits
mailing list