[llvm] [AMDGPU] Fold into uses of splat REG_SEQUENCEs through COPYs. (PR #145691)

Ivan Kosarev via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 27 03:20:00 PDT 2025


================
@@ -1164,11 +1164,18 @@ void SIFoldOperandsImpl::foldOperand(
     // Grab the use operands first
     SmallVector<MachineOperand *, 4> UsesToProcess(
         llvm::make_pointer_range(MRI->use_nodbg_operands(RegSeqDstReg)));
-    for (auto *RSUse : UsesToProcess) {
+    for (unsigned I = 0; I != UsesToProcess.size(); ++I) {
+      MachineOperand *RSUse = UsesToProcess[I];
       MachineInstr *RSUseMI = RSUse->getParent();
       unsigned OpNo = RSUseMI->getOperandNo(RSUse);
 
       if (SplatRC) {
+        if (RSUseMI->isCopy()) {
----------------
kosarev wrote:

I guess this could be `isFoldableCopy()`, but I hesitate to use it without test coverage.

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


More information about the llvm-commits mailing list