[llvm] [AtomicExpandPass] Match isIdempotentRMW with InstcombineRMW (PR #142277)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 12:40:16 PDT 2025


================
@@ -85,6 +85,26 @@ define i8 @atomic_max_smin_char(ptr %addr) {
   ret i8 %res
 }
 
+; Idempotent atomicrmw are still canonicalized.
+define i8 @atomic_min_umax_char(ptr %addr) {
+; CHECK-LABEL: @atomic_min_umax_char(
+; CHECK-NEXT:    [[RES:%.*]] = atomicrmw or ptr [[ADDR:%.*]], i8 0 monotonic, align 1
+; CHECK-NEXT:    ret i8 [[RES]]
+;
+  %res = atomicrmw umin ptr %addr, i8 255 monotonic
+  ret i8 %res
+}
+
+; Idempotent atomicrmw are still canonicalized.
+define i8 @atomic_max_umin_char(ptr %addr) {
----------------
topperc wrote:

Does this provide anything not covered by the existing `atomic_umax_zero`?

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


More information about the llvm-commits mailing list