[llvm] [AMDGPU] Reland "Remove redundant s_cmp_lg_* sX, 0" (PR #164201)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct 21 08:08:21 PDT 2025
    
    
  
================
@@ -593,3 +593,35 @@ define amdgpu_ps i32 @not64(i64 inreg %val0) {
   %zext = zext i1 %cmp to i32
   ret i32 %zext
 }
+
+
+; --------------------------------------------------------------------------------
+; Negative tests
+; --------------------------------------------------------------------------------
+
+ at 1 = external dso_local addrspace(4) constant i32
+
+define amdgpu_ps i32 @si_pc_add_rel_offset_must_not_optimize(ptr addrspace(1) %out) {
+; CHECK-LABEL: si_pc_add_rel_offset_must_not_optimize:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    s_getpc_b64 s[0:1]
+; CHECK-NEXT:    s_add_u32 s0, s0, __unnamed_1 at rel32@lo+4
+; CHECK-NEXT:    s_addc_u32 s1, s1, __unnamed_1 at rel32@hi+12
+; CHECK-NEXT:    s_cmp_lg_u64 s[0:1], 0
+; CHECK-NEXT:    s_cbranch_scc0 .LBB35_2
+; CHECK-NEXT:  ; %bb.1: ; %endif
+; CHECK-NEXT:    s_mov_b32 s0, 1
+; CHECK-NEXT:    s_branch .LBB35_3
+; CHECK-NEXT:  .LBB35_2: ; %if
+; CHECK-NEXT:    s_mov_b32 s0, 0
+; CHECK-NEXT:    s_branch .LBB35_3
+; CHECK-NEXT:  .LBB35_3:
+  %cmp = icmp ne ptr addrspace(4) @1, null
----------------
LU-JOHN wrote:
Changed global to use weak linkage.
https://github.com/llvm/llvm-project/pull/164201
    
    
More information about the llvm-commits
mailing list