[llvm] [AMDGPU] Preserve live SCC when shrinking disjoint S_OR_B32 to S_ADDK_I32 (PR #228025)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 07:54:14 PDT 2026


================
@@ -29,3 +30,31 @@ define amdgpu_ps i32 @s_or_b32_to_s_bitset1_b32(i32 inreg %x) {
   ret i32 %or
 }
 
+define amdgpu_ps i32 @s_or_b32_disjoint_live_scc(i32 inreg %n) {
+; CHECK-LABEL: s_or_b32_disjoint_live_scc:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    s_lshl_b32 s0, s0, 31
+; CHECK-NEXT:    s_or_b32 s0, s0, 0x800
+; CHECK-NEXT:    s_cselect_b32 s0, 0, 1
+; CHECK-NEXT:    ; return to shader part epilog
+entry:
+  switch i32 0, label %tail [
----------------
arsenm wrote:

avoid switch In this test? Most of this is clearly folding away 

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


More information about the llvm-commits mailing list