[llvm] [AMDGPU] Set register bank for i1 register copies (PR #96155)

Jun Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 12:02:04 PDT 2024


================
@@ -3735,17 +3735,27 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
   const MachineRegisterInfo &MRI = MF.getRegInfo();
 
   if (MI.isCopy() || MI.getOpcode() == AMDGPU::G_FREEZE) {
+    Register DstReg = MI.getOperand(0).getReg();
+    Register SrcReg = MI.getOperand(1).getReg();
+
     // The default logic bothers to analyze impossible alternative mappings. We
     // want the most straightforward mapping, so just directly handle this.
-    const RegisterBank *DstBank = getRegBank(MI.getOperand(0).getReg(), MRI,
-                                             *TRI);
-    const RegisterBank *SrcBank = getRegBank(MI.getOperand(1).getReg(), MRI,
-                                             *TRI);
+    const RegisterBank *DstBank = getRegBank(DstReg, MRI, *TRI);
+    const RegisterBank *SrcBank = getRegBank(SrcReg, MRI, *TRI);
     assert(SrcBank && "src bank should have been assigned already");
+
+    // For COPY between a physical reg and an s1, set dst bank to VCCRegBank
+    // so that the copy is allowed.
----------------
jwanggit86 wrote:

Done.

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


More information about the llvm-commits mailing list