[llvm] [AMDGPU] Generate waterfall for calls with SGPR(inreg) argument (PR #146997)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 08:17:54 PDT 2025


================
@@ -898,12 +898,20 @@ bool SIFixSGPRCopies::lowerSpecialCase(MachineInstr &MI,
               TII->get(AMDGPU::V_READFIRSTLANE_B32), TmpReg)
           .add(MI.getOperand(1));
       MI.getOperand(1).setReg(TmpReg);
-    } else if (tryMoveVGPRConstToSGPR(MI.getOperand(1), DstReg, MI.getParent(),
-                                      MI, MI.getDebugLoc())) {
+      return true;
+    }
+
+    if (tryMoveVGPRConstToSGPR(MI.getOperand(1), DstReg, MI.getParent(), MI,
+                               MI.getDebugLoc())) {
       I = std::next(I);
       MI.eraseFromParent();
+      return true;
+    }
+
+    if (!SrcReg.isVirtual() || TRI->getRegSizeInBits(SrcReg, *MRI) !=
+                                   TRI->getRegSizeInBits(DstReg, *MRI)) {
+      return true;
----------------
shiltian wrote:

remove `{}`

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


More information about the llvm-commits mailing list