[clang] [CIR][NFC] Update existing atomic ops to match assembly conventions (PR #161543)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 1 10:53:51 PDT 2025


================
@@ -4224,12 +4226,8 @@ def CIR_AtomicCmpXchg : CIR_Op<"atomic.cmpxchg", [
     Example:
 
     ```mlir
-    %old, %success = cir.atomic.cmpxchg(%ptr : !cir.ptr<!u64i>,
-                                        %expected : !u64i,
-                                        %desired : !u64i,
-                                        success = seq_cst,
-                                        failure = seq_cst) weak
-                                        : (!u64i, !cir.bool)
+    %old, %success = cir.atomic.cmpxchg weak seq_cst %ptr, %expected, %desired : !cir.ptr<!u64i> -> (!u64i, !cir.bool)
----------------
andykaylor wrote:

This doesn't seem right. The type of `%expected` and `%desired` can be inferred from the type of `ptr` but I would have expected them to be shown.


```suggestion
    %old, %success = cir.atomic.cmpxchg weak seq_cst %ptr, %expected, %desired 
                                       : (!cir.ptr<!u64i>, !u64, !u64) -> (!u64i, !cir.bool)
```

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


More information about the cfe-commits mailing list