[llvm] [AMDGPU] Multi dword spilling for unaligned tuples (PR #183701)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 01:25:36 PDT 2026


================
@@ -1732,10 +1746,31 @@ void SIRegisterInfo::buildSpillLoadStore(
 
   for (unsigned i = 0, e = NumSubRegs + NumRemSubRegs, RegOffset = 0; i != e;
        ++i, RegOffset += EltSize) {
-    if (i == NumSubRegs) {
-      EltSize = RemSize;
+    unsigned SavedEltSize = EltSize;
+    if (i == 0 && IsRegMisaligned) {
+      // For misaligned register tuples, spill only the first sub-reg in the
+      // first iteration.
+      EltSize = 4u;
       LoadStoreOp = getFlatScratchSpillOpcode(TII, LoadStoreOp, EltSize);
     }
+    if (i == 1 && IsRegMisaligned) {
----------------
easyonaadit wrote:

Yupp got it.

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


More information about the llvm-commits mailing list