[llvm-branch-commits] [llvm] [AMDGPU] Prevent SI_CS_CHAIN instruction from giving registers classes in generic instructions (PR #131329)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 14 06:09:56 PDT 2025


================
@@ -1278,7 +1278,11 @@ bool AMDGPUCallLowering::lowerTailCall(
       if (auto CI = dyn_cast<ConstantInt>(Arg.OrigValue)) {
         MIB.addImm(CI->getSExtValue());
       } else {
-        MIB.addReg(Arg.Regs[0]);
+        Register Reg = Arg.Regs[0];
+        if (!MRI.getVRegDef(Reg)->isCopy())
+          Reg = MIRBuilder.buildCopy(MRI.getType(Reg), Reg).getReg(0);
----------------
arsenm wrote:

If you need to adjust the class, should use constrainOperandRegClass instead of special casing copy 

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


More information about the llvm-branch-commits mailing list