File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -738,8 +738,13 @@ void SILGenFunction::emitValueConstructor(ConstructorDecl *ctor) {
738
738
// move only structs are non-trivial, so we need to handle this here.
739
739
if (nominal->getAttrs ().hasAttribute <RawLayoutAttr>()) {
740
740
// Raw memory is not directly decomposable, but we still want to mark
741
- // it as initialized. Use a zero initializer.
742
- B.createZeroInitAddr (ctor, selfLV.getLValueAddress ());
741
+ // it as initialized.
742
+ auto prepInit = getBuiltinValueDecl (getASTContext (),
743
+ getASTContext ().getIdentifier (" prepareInitialization" ));
744
+ B.createBuiltin (ctor, prepInit->getBaseIdentifier (),
745
+ SILType::getEmptyTupleType (getASTContext ()),
746
+ SubstitutionMap (),
747
+ selfLV.getLValueAddress ());
743
748
} else if (isa<StructDecl>(nominal)
744
749
&& lowering.getLoweredType ().isMoveOnly ()
745
750
&& nominal->getStoredProperties ().empty ()) {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ struct Lock: ~Copyable {
20
20
// CHECK-NEXT: sil{{.*}} @[[INIT:\$.*4LockV.*fC]] :
21
21
init ( ) {
22
22
// CHECK-NOT: destroy_addr
23
- // CHECK: builtin "zeroInitializer "({{%.*}} : $*Lock)
23
+ // CHECK: builtin "prepareInitialization "({{%.*}} : $*Lock)
24
24
// CHECK-NOT: destroy_addr
25
25
// CHECK: [[F:%.*]] = function_ref @init_lock
26
26
// CHECK: apply [[F]](
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public struct Cell<T: ~Copyable>: ~Copyable {
20
20
21
21
// CHECK-LABEL: sil {{.*}} @$s4CellAAVAARi_zrlEyAByxGxcfC : $@convention(method) <T where T : ~Copyable> (@in T, @thin Cell<T>.Type) -> @out Cell<T> {
22
22
// CHECK: bb0({{%.*}} : $*Cell<T>, [[VALUE:%.*]] : $*T, {{%.*}} : $@thin Cell<T>.Type):
23
- // CHECK: {{%.*}} = builtin "zeroInitializer "([[SELF:%.*]] : $*Cell<T>) : $()
23
+ // CHECK: {{%.*}} = builtin "prepareInitialization "([[SELF:%.*]] : $*Cell<T>) : $()
24
24
// CHECK-NEXT: [[RAW_LAYOUT_ADDR:%.*]] = builtin "addressOfRawLayout"<Cell<T>>([[SELF]] : $*Cell<T>) : $Builtin.RawPointer
25
25
// CHECK-NEXT: [[POINTER:%.*]] = struct $UnsafeMutablePointer<T> ([[RAW_LAYOUT_ADDR]] : $Builtin.RawPointer)
26
26
// Calling 'UnsafeMutablePointer<T>.initialize(to:)'
You can’t perform that action at this time.
0 commit comments