Skip to content

Commit 89fab1b

Browse files
authored
Allow the creation of a shadow variable when the type is a refcounted pointer (#34835)
1 parent b9122ef commit 89fab1b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/IRGen/IRGenSIL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ class IRGenSILFunction :
758758
if (IGM.IRGen.Opts.DisableDebuggerShadowCopies ||
759759
IGM.IRGen.Opts.shouldOptimize() || IsAnonymous ||
760760
isa<llvm::AllocaInst>(Storage) || isa<llvm::UndefValue>(Storage) ||
761-
Storage->getType() == IGM.RefCountedPtrTy || !needsShadowCopy(Storage))
761+
!needsShadowCopy(Storage))
762762
return Storage;
763763

764764
// Emit a shadow copy.

test/IRGen/builtins.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,9 +759,10 @@ func generic_unsafeGuaranteed_test<T: AnyObject>(_ t : T) -> T {
759759
}
760760

761761
// CHECK-LABEL: define {{.*}} @{{.*}}unsafeGuaranteed_test
762-
// CHECK: [[LOCAL:%.*]] = alloca %swift.refcounted*
762+
// CHECK: [[LOCAL1:%.*]] = alloca %swift.refcounted*
763+
// CHECK: [[LOCAL2:%.*]] = alloca %swift.refcounted*
763764
// CHECK: call %swift.refcounted* @swift_retain(%swift.refcounted* returned %0)
764-
// CHECK: store %swift.refcounted* %0, %swift.refcounted** [[LOCAL]]
765+
// CHECK: store %swift.refcounted* %0, %swift.refcounted** [[LOCAL2]]
765766
// CHECK-NOT: call void @swift_release(%swift.refcounted* %0)
766767
// CHECK: ret %swift.refcounted* %0
767768
func unsafeGuaranteed_test(_ x: Builtin.NativeObject) -> Builtin.NativeObject {

0 commit comments

Comments
 (0)