================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to