[PATCH] D90064: [AMDGPU] Fixed isLegalRegOperand() with physregs
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 11:13:56 PDT 2020
rampitec created this revision.
rampitec added a reviewer: arsenm.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: LLVM.
rampitec requested review of this revision.
Herald added a subscriber: wdng.
This does not change anything at the moment, but needed for
D89170 <https://reviews.llvm.org/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.
https://reviews.llvm.org/D90064
Files:
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -4303,10 +4303,13 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90064.300352.patch
Type: text/x-patch
Size: 754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201023/ab377878/attachment-0001.bin>
More information about the llvm-commits
mailing list