================ @@ -2268,13 +2293,22 @@ CodeGenFunction::EmitNullInitialization(Address DestPtr, QualType Ty) { // Get and call the appropriate llvm.memcpy overload. Builder.CreateMemCpy(DestPtr, SrcPtr, SizeVal, false); - return; + } else { + // Otherwise, just memset the whole thing to zero. This is legal ---------------- ojhunt wrote:
This means types that require constructors will be doing zero initialization, then reinitializing fields. From a codegen PoV this can lead to codegen along the lines of ``` zero the memory; // compiler is set to initialize all memory zero the memory; // this branch means objects that are not zero initializable get initialized again initialize the memory; // the struct is not zero initializable the constructor/initializer will run ``` Ideally the compiler will optimized this down, but it's both extra codegen, and extra optimization work. Given that your model assumes that null is a safe value for PFP fields, the `isZeroInitializable()` call should return true. For non-zero initializable objects, the initialization code for the object is responsible for initializing the PFP fields. https://github.com/llvm/llvm-project/pull/133538 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits