================ @@ -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 ---------------- pcc wrote:
A PFP field containing a null pointer has a non-null bit pattern (it is a signed null). This is to avoid a conditional branch at every location when loading/storing a pointer and the nullness of the pointer cannot be statically determined. That's why we need to store nulls here. The EmitNullInitialization function is not used in case of a constructor call. It is used in cases like ``` struct S { void *p; }; void f() { S s{}; } ``` I am not adding a call to memset here. The change here is a bit confusing because I needed to change some of the indentation to get rid of an early return. The memset previously on line 2277, which was moved to line 2301, was previously, and is now, being executed if `isZeroInitializable`. The only code being added is the null stores. 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