================
@@ -185,6 +203,18 @@ CALL_AO(PackedMembers)
 // CHECK: call void @llvm.memcpy.p0.p0.i64({{.*}} align 1 {{.*}} align 1 
{{.*}}i64 16, i1 {{.*}})
 // CHECK: ret ptr
 
+// WithEmptyField copy-assignment:
+// CHECK-LABEL: define linkonce_odr nonnull align {{[0-9]+}} 
dereferenceable({{[0-9]+}}) ptr @_ZN14WithEmptyFieldaSERKS_
+// CHECK: call void @llvm.memcpy.p0.p0.i64({{.*}} align 4 {{.*}} align 4 
{{.*}}i64 4, i1 {{.*}})
----------------
Michael137 wrote:

@efriedma-quic Before this patch, this would've been a `memcpy` of size `5`. 
But the structure layout for `WithEmptyField` changed from:
```
%struct.WithEmptyField = type { i32, %struct.Empty, %struct.NonPOD, i32 }
%struct.Empty = type { i8 }                                   
%struct.NonPOD = type { i16 }                                 
```
to
```
struct.Foo = type { i32, %struct.NonPOD, i32 }
struct.NonPOD = type { i16 }                  
```
As you said, if we kept the `isZeroSize` check when generating this `memcpy` we 
would've written too much.

https://github.com/llvm/llvm-project/pull/96422
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to