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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 18:09:24 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:

I'm confused about the state of this hack. There are no 16-bit SGPRs, which is the problem. But sometimes there are, artificially? 

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


More information about the llvm-commits mailing list