Skip to content

Commit 4dc6e6e

Browse files
committed
[move-keyword] Remove old implementation.
By using the keyword instead of the function, we actually get a much simpler implementation since we avoid all of the machinery of SILGenApply. Given that we are going down that path, I am removing the old builtin implementation since it is dead code. The reason why I am removing this now is that in a subsequent commit, I want to move all of the ownership checking passes to run /before/ mandatory inlining. I originally placed the passes after mandatory inlining since the function version of the move keyword was transparent and needing to be inlined before we could process it. Since we use the keyword now, that is no longer an issue.
1 parent b65e1bb commit 4dc6e6e

File tree

16 files changed

+1
-406
lines changed

16 files changed

+1
-406
lines changed

include/swift/AST/Builtins.def

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -774,19 +774,6 @@ BUILTIN_MISC_OPERATION(CreateTaskGroup,
774774
BUILTIN_MISC_OPERATION(DestroyTaskGroup,
775775
"destroyTaskGroup", "", Special)
776776

777-
778-
/// A builtin that can only be called from a transparent generic function. Takes
779-
/// two operands, the first operand the result address, the second operand the
780-
/// input address. Transforms into load [take] + move_value + store [init] when
781-
/// transparently inlined into a caller that has the generic of the callee
782-
/// specialized into a loadable type. If the transparent inlining does not
783-
/// specialize the type (due to being inlined into a non-generic context, the
784-
/// SILVerifier will abort).
785-
///
786-
/// Illegal to call except for in Swift._move in the stdlib. This is enforced by
787-
/// the SILVerifier.
788-
BUILTIN_MISC_OPERATION(Move, "move", "", Special)
789-
790777
/// A builtin that can only be called from a transparent generic function. Takes
791778
/// two operands, the first operand the result address, the second operand the
792779
/// input address. Transforms into

include/swift/Basic/Features.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ LANGUAGE_FEATURE(ImplicitSelfCapture, 0, "@_implicitSelfCapture attribute", true
7979
LANGUAGE_FEATURE(BuiltinBuildExecutor, 0, "Executor-building builtins", true)
8080
LANGUAGE_FEATURE(BuiltinBuildMainExecutor, 0, "MainActor executor building builtin", true)
8181
LANGUAGE_FEATURE(BuiltinCreateAsyncTaskInGroup, 0, "MainActor executor building builtin", true)
82-
LANGUAGE_FEATURE(BuiltinMove, 0, "Builtin.move()", true)
8382
LANGUAGE_FEATURE(BuiltinCopy, 0, "Builtin.copy()", true)
8483
LANGUAGE_FEATURE(BuiltinStackAlloc, 0, "Builtin.stackAlloc", true)
8584
LANGUAGE_FEATURE(BuiltinTaskRunInline, 0, "Builtin.taskRunInline", true)

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,6 @@ PASS(LexicalLifetimeEliminator, "sil-lexical-lifetime-eliminator",
462462
PASS(MoveKillsCopyableAddressesChecker, "sil-move-kills-copyable-addresses-checker",
463463
"Pass that checks that any copyable (non-move only) address that is passed "
464464
"to _move do not have any uses later than the _move")
465-
PASS(MoveFunctionCanonicalization, "sil-move-function-canon",
466-
"Pass that canonicalizes certain parts of the IR before we perform move "
467-
"function checking.")
468465
PASS(DebugInfoCanonicalizer, "sil-onone-debuginfo-canonicalizer",
469466
"Canonicalize debug info at -Onone by propagating debug info into coroutine funclets")
470467
PASS(PartialApplySimplification, "partial-apply-simplification",

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,10 +2917,6 @@ static bool usesFeatureBuiltinCreateAsyncTaskInGroup(Decl *decl) {
29172917
return false;
29182918
}
29192919

2920-
static bool usesFeatureBuiltinMove(Decl *decl) {
2921-
return false;
2922-
}
2923-
29242920
static bool usesFeatureBuiltinCopy(Decl *decl) { return false; }
29252921

29262922
static bool usesFeatureBuiltinTaskRunInline(Decl *) { return false; }

lib/AST/Builtins.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -851,11 +851,6 @@ static ValueDecl *getDestroyArrayOperation(ASTContext &ctx, Identifier id) {
851851
_void);
852852
}
853853

854-
static ValueDecl *getMoveOperation(ASTContext &ctx, Identifier id) {
855-
return getBuiltinFunction(ctx, id, _thin, _generics(_unrestricted),
856-
_parameters(_owned(_typeparam(0))), _typeparam(0));
857-
}
858-
859854
static ValueDecl *getCopyOperation(ASTContext &ctx, Identifier id) {
860855
return getBuiltinFunction(ctx, id, _thin, _generics(_unrestricted),
861856
_parameters(_typeparam(0)), _typeparam(0));
@@ -2537,11 +2532,6 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
25372532
if (!Types.empty()) return nullptr;
25382533
return getEndUnpairedAccessOperation(Context, Id);
25392534

2540-
case BuiltinValueKind::Move:
2541-
if (!Types.empty())
2542-
return nullptr;
2543-
return getMoveOperation(Context, Id);
2544-
25452535
case BuiltinValueKind::Copy:
25462536
if (!Types.empty())
25472537
return nullptr;

lib/IRGen/GenBuiltin.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,17 +1307,6 @@ if (Builtin.ID == BuiltinValueKind::id) { \
13071307
return;
13081308
}
13091309

1310-
if (Builtin.ID == BuiltinValueKind::Move) {
1311-
auto input = args.claimNext();
1312-
auto result = args.claimNext();
1313-
SILType addrTy = argTypes[0];
1314-
const TypeInfo &addrTI = IGF.getTypeInfo(addrTy);
1315-
Address inputAttr = addrTI.getAddressForPointer(input);
1316-
Address resultAttr = addrTI.getAddressForPointer(result);
1317-
addrTI.initializeWithTake(IGF, resultAttr, inputAttr, addrTy, false);
1318-
return;
1319-
}
1320-
13211310
if (Builtin.ID == BuiltinValueKind::Copy) {
13221311
auto input = args.claimNext();
13231312
auto result = args.claimNext();

lib/SIL/IR/OperandOwnership.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,6 @@ BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, GlobalStringTablePointer)
795795
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, TypePtrAuthDiscriminator)
796796
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, TargetOSVersionAtLeast)
797797
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, IntInstrprofIncrement)
798-
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, Move)
799798
BUILTIN_OPERAND_OWNERSHIP(UnownedInstantaneousUse, Copy)
800799
BUILTIN_OPERAND_OWNERSHIP(DestroyingConsume, StartAsyncLet)
801800
BUILTIN_OPERAND_OWNERSHIP(DestroyingConsume, EndAsyncLet)

lib/SIL/IR/ValueOwnership.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,6 @@ CONSTANT_OWNERSHIP_BUILTIN(None, EndAsyncLetLifetime)
560560
CONSTANT_OWNERSHIP_BUILTIN(None, CreateTaskGroup)
561561
CONSTANT_OWNERSHIP_BUILTIN(None, DestroyTaskGroup)
562562
CONSTANT_OWNERSHIP_BUILTIN(None, TaskRunInline)
563-
CONSTANT_OWNERSHIP_BUILTIN(None, Move)
564563
CONSTANT_OWNERSHIP_BUILTIN(None, Copy)
565564

566565
#undef CONSTANT_OWNERSHIP_BUILTIN

lib/SIL/Utils/MemAccessUtils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,6 @@ static void visitBuiltinAddress(BuiltinInst *builtin,
24602460
return;
24612461

24622462
// These effect both operands.
2463-
case BuiltinValueKind::Move:
24642463
case BuiltinValueKind::Copy:
24652464
visitor(&builtin->getAllOperands()[1]);
24662465
return;

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,22 +2017,6 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
20172017
return;
20182018
}
20192019

2020-
if (builtinKind == BuiltinValueKind::Move) {
2021-
// We expect that this builtin will be specialized during transparent
2022-
// inlining into move_value if we inline into a non-generic context. If
2023-
// the builtin still remains and is not in the specific move semantic
2024-
// function (which is the only function marked with
2025-
// semantics::LIFETIMEMANAGEMENT_MOVE), then we know that we did
2026-
// transparent inlining into a function that did not result in the Builtin
2027-
// being specialized out which is user error.
2028-
//
2029-
// NOTE: Once we have opaque values, this restriction will go away. This
2030-
// is just so we can call Builtin.move outside of the stdlib.
2031-
auto semanticName = semantics::LIFETIMEMANAGEMENT_MOVE;
2032-
require(BI->getFunction()->hasSemanticsAttr(semanticName),
2033-
"_move used within a generic context");
2034-
}
2035-
20362020
if (builtinKind == BuiltinValueKind::Copy) {
20372021
// We expect that this builtin will be specialized during transparent
20382022
// inlining into explicit_copy_value if we inline into a non-generic

lib/SILOptimizer/Mandatory/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ target_sources(swiftSILOptimizer PRIVATE
2222
LowerHopToActor.cpp
2323
MandatoryInlining.cpp
2424
MovedAsyncVarDebugInfoPropagator.cpp
25-
MoveFunctionCanonicalization.cpp
2625
MoveKillsCopyableAddressesChecker.cpp
2726
MoveKillsCopyableValuesChecker.cpp
2827
MoveOnlyObjectChecker.cpp

0 commit comments

Comments
 (0)