[clang] [CIR] Upstream support for array new with empty initializer list (PR #178806)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 30 10:44:28 PST 2026
================
@@ -3540,6 +3540,41 @@ def CIR_MemCpyOp : CIR_MemOp<"libc.memcpy"> {
// TODO: MemMoveOp
+//===----------------------------------------------------------------------===//
+// MemSetOp
+//===----------------------------------------------------------------------===//
+
+def CIR_MemSetOp : CIR_Op<"libc.memset"> {
+ let summary = "Equivalent to libc's `memset`";
+ let description = [{
+ Given the CIR pointer, `dst`, `cir.libc.memset` will set the first `len`
+ bytes of the memory pointed by `dst` to the specified `val`.
+
+ Examples:
+
+ ```mlir
+ // Set 2 bytes from a record to 0:
+ %2 = cir.const #cir.int<2> : !u32i
+ %3 = cir.const #cir.int<0> : !u32i
+ %zero = cir.cast integral %3 : !s32i -> !u8i
+ cir.libc.memset %2 bytes from %record set to %zero : !cir.ptr<!void>,
----------------
erichkeane wrote:
Hrmph... ok, those are fine then. Slight preference to omit 'set' to be more like memcpy, but otherwise no concern as their is prior art.
https://github.com/llvm/llvm-project/pull/178806
More information about the cfe-commits
mailing list