[clang] [CIR] Add handling for volatile loads and stores (PR #156124)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 2 10:23:27 PDT 2025
================
@@ -416,18 +420,26 @@ def CIR_LoadOp : CIR_Op<"load", [
// Load address from memory at address %0. %3 is used by at least one
// operation that dereferences a pointer.
%3 = cir.load deref %0 : !cir.ptr<!cir.ptr<i32>>
+
+ // Perform a volatile load from address in %0.
+ %4 = cir.load volatile %0 : !cir.ptr<i32>, i32
+
+ // Others
+ %x = cir.load align(16) atomic(seq_cst) %0 : !cir.ptr<i32>, i32
```
}];
let arguments = (ins Arg<CIR_PointerType, "the address to load from",
[MemRead]>:$addr,
UnitAttr:$isDeref,
OptionalAttr<I64Attr>:$alignment,
+ UnitAttr:$is_volatile,
----------------
andykaylor wrote:
The ordering here matched the order of these elements in the LLVM dialect, but it doesn't match the order of the parameters in our createLoad and createStore functions. Your suggested reordering would match those parameters (which I think are consistent with OGCG), so I'll proceed with the suggestion.
https://github.com/llvm/llvm-project/pull/156124
More information about the cfe-commits
mailing list