Skip to content

Commit bf6058b

Browse files
Merge pull request #73443 from nate-chandler/rdar127516085
[AST] Remove Builtin.copy.
2 parents 6f02aa6 + c10d39e commit bf6058b

File tree

5 files changed

+0
-55
lines changed

5 files changed

+0
-55
lines changed

include/swift/AST/Builtins.def

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,14 +537,6 @@ BUILTIN_SIL_OPERATION(HopToActor, "hopToActor", None)
537537
/// Returns the number of items in a pack.
538538
BUILTIN_SIL_OPERATION(PackLength, "packLength", Special)
539539

540-
/// TODO: Remove. Only exists to avoid a reverse condfail.
541-
/// rdar://127516085 (Complete removal of Builtin.copy)
542-
///
543-
/// copy: <T>(T) -> T
544-
///
545-
/// Creates a copy of the source at the destination.
546-
BUILTIN_SIL_OPERATION(Copy, "copy", Special)
547-
548540
// BUILTIN_RUNTIME_CALL - A call into a runtime function.
549541
// These functions accept a single argument of any type.
550542
#ifndef BUILTIN_RUNTIME_CALL

include/swift/Basic/Features.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ LANGUAGE_FEATURE(BuiltinCreateAsyncTaskInGroupWithExecutor, 0, "Task create in t
140140
LANGUAGE_FEATURE(BuiltinCreateAsyncDiscardingTaskInGroup, 0, "Task create in discarding task group builtin, accounting for the Void return type")
141141
BASELINE_LANGUAGE_FEATURE(BuiltinCreateAsyncTaskWithExecutor, 0, "Task create builtin with extra executor preference")
142142
LANGUAGE_FEATURE(BuiltinCreateAsyncDiscardingTaskInGroupWithExecutor, 0, "Task create in discarding task group with extra executor preference")
143-
BASELINE_LANGUAGE_FEATURE(BuiltinCopy, 0, "Builtin.copy()")
144143
BASELINE_LANGUAGE_FEATURE(BuiltinStackAlloc, 0, "Builtin.stackAlloc")
145144
LANGUAGE_FEATURE(BuiltinUnprotectedStackAlloc, 0, "Builtin.unprotectedStackAlloc")
146145
LANGUAGE_FEATURE(BuiltinAllocVector, 0, "Builtin.allocVector")

lib/AST/Builtins.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -901,14 +901,6 @@ static ValueDecl *getDestroyArrayOperation(ASTContext &ctx, Identifier id) {
901901
_void);
902902
}
903903

904-
static ValueDecl *getCopyOperation(ASTContext &ctx, Identifier id) {
905-
return getBuiltinFunction(ctx, id, _thin,
906-
_generics(_unrestricted,
907-
_conformsTo(_typeparam(0), _copyable),
908-
_conformsTo(_typeparam(0), _escapable)),
909-
_parameters(_typeparam(0)), _typeparam(0));
910-
}
911-
912904
static ValueDecl *getAssumeAlignment(ASTContext &ctx, Identifier id) {
913905
// This is always "(Builtin.RawPointer, Builtin.Word) -> Builtin.RawPointer"
914906
return getBuiltinFunction(ctx, id, _thin, _parameters(_rawPointer, _word),
@@ -2786,11 +2778,6 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
27862778
if (!Types.empty()) return nullptr;
27872779
return getEndUnpairedAccessOperation(Context, Id);
27882780

2789-
case BuiltinValueKind::Copy:
2790-
if (!Types.empty())
2791-
return nullptr;
2792-
return getCopyOperation(Context, Id);
2793-
27942781
case BuiltinValueKind::AssumeAlignment:
27952782
if (!Types.empty())
27962783
return nullptr;

lib/SILGen/SILGenBuiltin.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,23 +2027,6 @@ static ManagedValue emitBuiltinAddressOfRawLayout(SILGenFunction &SGF,
20272027
return ManagedValue::forObjectRValueWithoutOwnership(bi);
20282028
}
20292029

2030-
/// TODO: Remove. Only exists to avoid a reverse condfail.
2031-
/// rdar://127516085 (Complete removal of Builtin.copy)
2032-
static ManagedValue emitBuiltinCopy(SILGenFunction &SGF, SILLocation loc,
2033-
SubstitutionMap subs,
2034-
ArrayRef<ManagedValue> args, SGFContext C) {
2035-
// Builtin.copy has no uses in current/future swiftinterfaces. It has a
2036-
// single use in old swiftinterfaces:
2037-
// func _copy<T>(_ t: T) -> T {
2038-
// Builtin.copy(t)
2039-
// }
2040-
// It is sufficient to have the builtin pass the value through. When the
2041-
// return is emitted, a copy will be made.
2042-
assert(args.size() == 1 && "not two arguments!?");
2043-
return ManagedValue::forOwnedAddressRValue(args[0].getValue(),
2044-
CleanupHandle::invalid());
2045-
}
2046-
20472030
std::optional<SpecializedEmitter>
20482031
SpecializedEmitter::forDecl(SILGenModule &SGM, SILDeclRef function) {
20492032
// Only consider standalone declarations in the Builtin module.

test/stdlib/LifetimeManagement.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,3 @@ suite.test("move") {
2626
}
2727

2828
runAllTests()
29-
30-
// TODO: Remove. Only exists to avoid a reverse condfail.
31-
// rdar://127516085 (Complete removal of Builtin.copy)
32-
func _oldCopy<T>(_ value: T) -> T {
33-
#if $BuiltinCopy
34-
Builtin.copy(value)
35-
#else
36-
value
37-
#endif
38-
}
39-
40-
suite.test("_oldCopy") {
41-
let k = Klass()
42-
expectTrue(k === _oldCopy(k))
43-
}
44-

0 commit comments

Comments
 (0)