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

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 00:05:04 PDT 2025


================
@@ -1128,6 +1169,45 @@ void SIFixSGPRCopies::lowerVGPR2SGPRCopies(MachineFunction &MF) {
   }
 }
 
+void SIFixSGPRCopies::lowerPysicalSGPRInsts(MachineFunction &MF) {
+  for (auto &Entry : WaterFalls) {
+    MachineInstr *MI = Entry.first;
+    const V2PhysSCopyInfo &Info = Entry.second;
+    assert((Info.MOs.size() != 0 && Info.SGPRs.size() == Info.MOs.size()) &&
+           "Error in MOs or SGPRs size.");
+
+    if (MI->getOpcode() == AMDGPU::SI_CALL_ISEL) {
----------------
jmmartinez wrote:

This whole `if` looks very similar the one in `legalizeOperands`.

Can you refactor them into a common function ? 

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


More information about the llvm-commits mailing list