[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:48 PDT 2025


================
@@ -726,7 +731,9 @@ bool SIFoldOperandsImpl::updateOperand(FoldCandidate &Fold) const {
 
   // Rework once the VS_16 register class is updated to include proper
   // 16-bit SGPRs instead of 32-bit ones.
-  if (Old.getSubReg() == AMDGPU::lo16 && TRI->isSGPRReg(*MRI, New->getReg()))
+  if ((Old.getSubReg() == AMDGPU::lo16 &&
+       TRI->isSGPRReg(*MRI, New->getReg())) ||
+      !New->getSubReg())
     Old.setSubReg(AMDGPU::NoSubRegister);
----------------
arsenm wrote:

Can just change this to setSubReg(New->getSubreg())

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


More information about the llvm-commits mailing list