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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 00:51:12 PDT 2025


================
@@ -910,12 +910,18 @@ 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;
     }
-    return true;
+
+    if (!SrcReg.isVirtual())
+      return true;
----------------
arsenm wrote:

I don't understand this early exit, the !SrcReg.isVirtual() has existing explicit handling just below here 

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


More information about the llvm-commits mailing list