[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
Tue Oct 8 03:28:42 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:

> After another look, I think the problem here is quite different from the one in getInstrMapping()

The situation here is isomorphic. A physical register alone is not enough context to determine if it is interpreted as a boolean or not. You need the additional hint from the virtual register in the other operand to determine that, just like in the regbankselect case. 



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


More information about the llvm-commits mailing list