[llvm] [AMDGPU] Allow folding of non-subregs through REG_SEQUENCE (PR #151033)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 19 19:13:47 PDT 2025


================
@@ -1215,10 +1225,12 @@ void SIFoldOperandsImpl::foldOperand(
       if (RSUse->getSubReg() != RegSeqDstSubReg)
         continue;
 
+      RegSeqSourceWasSubreg = (UseOp->getSubReg() != AMDGPU::NoSubRegister) &&
+                              RegSeqSourceWasSubreg;
       // FIXME: We should avoid recursing here. There should be a cleaner split
       // between the in-place mutations and adding to the fold list.
       foldOperand(OpToFold, RSUseMI, RSUseMI->getOperandNo(RSUse), FoldList,
-                  CopiesToReplace);
+                  CopiesToReplace, RegSeqSourceWasSubreg);
----------------
arsenm wrote:

I don't understand this new argument, it's too specific. This should remain in terms of operands and sub registers 

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


More information about the llvm-commits mailing list