[clang] [CIR] Upstream support for array new with empty initializer list (PR #178806)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 30 11:10:33 PST 2026
================
@@ -197,6 +197,12 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
mlir::Value src, mlir::Value len) {
return cir::MemCpyOp::create(*this, loc, dst, src, len);
}
+
+ cir::MemSetOp createMemSet(mlir::Location loc, mlir::Value dst,
+ mlir::Value val, mlir::Value len) {
+ val = createIntCast(val, getUInt8Ty());
----------------
andykaylor wrote:
I kept a bitcast here, but I also considered just making it an assert. It becomes a noop if the type is already right and prevents a failure if it isn't. The incubator code calls this function in three places: the array new initializer I'm handling here, the memset builtin handler, and the BI__builtin___memset_chk handler.
The builtins get called with a 32-bit argument which the incubator code just passes through directly, but it occurs to me now that it probably does that because the incubator expects a 32-bit value for the operation. Classic codegen explicitly truncates the value argument before calling `IRBuilder::CreateMemset`. So now I'm thinking maybe an assert is the way to go.
https://github.com/llvm/llvm-project/pull/178806
More information about the cfe-commits
mailing list