================
@@ -1575,8 +1575,20 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl
&gd, unsigned builtinID,
case Builtin::BI__builtin_alloca_with_align_uninitialized:
case Builtin::BI__builtin_alloca_with_align:
case Builtin::BI__builtin_infer_alloc_token:
+ return errorBuiltinNYI(*this, e, builtinID);
case Builtin::BIbzero:
- case Builtin::BI__builtin_bzero:
+ case Builtin::BI__builtin_bzero: {
+ mlir::Location loc = getLoc(e->getSourceRange());
+ Address destPtr = emitPointerWithAlignment(e->getArg(0));
+ mlir::Value destPtrCast =
+ builder.createPtrBitcast(destPtr.getPointer(), cgm.voidTy);
+ mlir::Value size = emitScalarExpr(e->getArg(1));
+ mlir::Value zero = builder.getNullValue(builder.getUInt8Ty(), loc);
+ assert(!cir::MissingFeatures::sanitizers());
+ builder.createMemSet(loc, destPtrCast, zero, size);
----------------
andykaylor wrote:
Do we need alignment here? We're calling `emitPointerWithAlignment` to get an
Address, but then by switching to mlir::Value, we're not passing that alignment
on to the memset. The bitcast on line 1584 could be replaced by `destPtrCast =
destPtr.withElementType(builder, cgm.voidTy);` to keep it as an address
(`withElementType` inserts a bitcast), but we'd need a version of
`createMemSet` that takes an Address and does something with the alignment.
https://github.com/llvm/llvm-project/pull/184835
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits