[llvm] [AMDGPU] fix eliminateFrameIndex to use SGPR frame index (PR #178991)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 10 07:50:43 PST 2026


================
@@ -0,0 +1,35 @@
+# RUN: llc -mtriple=amdgcn -verify-machineinstrs -mcpu=gfx1030 -run-pass prologepilog -o - %s | FileCheck %s
+# CHECK: $sgpr5 = V_READFIRSTLANE_B32 $vgpr0, implicit $exec
+# CHECK: renamable $sgpr4 = S_CSELECT_B32 0, killed $sgpr5, implicit $scc
+--- |
+  %struct.wobble = type { %struct.quux }
+  %struct.quux = type { float, float, float }
+  define void @wobble() {
+    %alloca = alloca %struct.wobble, align 4, addrspace(5)
+    ret void
+  }
+...
+---
+name:            wobble
+tracksRegLiveness: true
+stack:
+  - { id: 0, name: alloca, offset: 0, size: 12}
+machineFunctionInfo:
+  scratchRSrcReg:  '$sgpr0_sgpr1_sgpr2_sgpr3'
+  frameOffsetReg:  '$sgpr33'
+  stackPtrOffsetReg: '$sgpr32'
+body:             |
+  bb.0:
+    renamable $vgpr41 = V_MOV_B32_e32 0, implicit $exec
+    renamable $sgpr4 = S_MOV_B32 0
+    renamable $sgpr54 = S_ADD_I32 %stack.0.alloca, 4, implicit-def dead $scc
+  bb.1:
+    liveins: $sgpr4, $sgpr54:0x000000000000000F
+    S_CMP_EQ_U32 killed renamable $sgpr4, 0, implicit-def $scc
+    renamable $sgpr4 = S_CSELECT_B32 0, %stack.0.alloca, implicit $scc
+    renamable $sgpr5 = S_CSELECT_B32 4, renamable $sgpr54, implicit $scc
+    S_CBRANCH_VCCNZ %bb.1, implicit undef $vcc
+    S_BRANCH %bb.2
+  bb.2:
+    SI_RETURN
+...
----------------
hjagasiaAMD wrote:

Minimal change to unblock Redshift compilation. Can work on a follow up patch for VOP3/e64.

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


More information about the llvm-commits mailing list