[llvm] [AMDGPU] In instruction selector, allow copy from physical reg to s1 (PR #96157)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 02:59:06 PDT 2024


================
@@ -131,6 +131,13 @@ bool AMDGPUInstructionSelector::selectCOPY(MachineInstr &I) const {
   Register SrcReg = Src.getReg();
 
   if (isVCC(DstReg, *MRI)) {
+    // Allow copy from physical register other than SCC to s1.
+    if (SrcReg.isPhysical() && SrcReg != AMDGPU::SCC) {
+      const TargetRegisterClass *DstRC = MRI->getRegClassOrNull(DstReg);
----------------
arsenm wrote:

You have to solve exactly the same problem as you did in the RegBankSelect pass. In the physical register case, you need to consider the virtual register type from the other operand. Querying the class on the destination register after checking isVCC does not give you additional information, isVCC needs the additional context for the physical register case 

https://github.com/llvm/llvm-project/pull/96157


More information about the llvm-commits mailing list