Skip to content

Commit 81cf1d9

Browse files
committed
SIL: Remove -sil-link-all frontend flag
It was only used in a few tests. Those tests now use -emit-sil instead of -emit-silgen, with some functions marked @_transparent and a few CHECK: lines changed now that the mandatory optimizations get to run.
1 parent cc58659 commit 81cf1d9

20 files changed

+197
-286
lines changed

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@ def sil_unroll_threshold : Separate<["-"], "sil-unroll-threshold">,
393393
def sil_merge_partial_modules : Flag<["-"], "sil-merge-partial-modules">,
394394
HelpText<"Merge SIL from all partial swiftmodules into the final module">;
395395

396-
def sil_link_all : Flag<["-"], "sil-link-all">,
397-
HelpText<"Link all SIL functions">;
398-
399396
def sil_verify_all : Flag<["-"], "sil-verify-all">,
400397
HelpText<"Verify SIL after each transform">;
401398

include/swift/SIL/SILModule.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,6 @@ class SILModule {
504504
/// i.e. it can be linked by linkFunction.
505505
bool hasFunction(StringRef Name);
506506

507-
/// Link in all Witness Tables in the module.
508-
void linkAllWitnessTables();
509-
510-
/// Link in all VTables in the module.
511-
void linkAllVTables();
512-
513507
/// Link all definitions in all segments that are logically part of
514508
/// the same AST module.
515509
void linkAllFromCurrentModule();

include/swift/SILOptimizer/PassManager/Passes.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ namespace swift {
5555
/// \brief Remove dead functions from \p M.
5656
void performSILDeadFunctionElimination(SILModule *M);
5757

58-
/// \brief Link a SILFunction declaration to the actual definition in the
59-
/// serialized modules.
60-
///
61-
/// \param M the SILModule on which to operate
62-
void performSILLinking(SILModule *M);
63-
6458
/// \brief Convert SIL to a lowered form suitable for IRGen.
6559
void runSILLoweringPasses(SILModule &M);
6660

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
576576
}
577577
}
578578

579-
if (const Arg *A = Args.getLastArg(OPT_disable_sil_linking,
580-
OPT_sil_link_all)) {
581-
if (A->getOption().matches(OPT_disable_sil_linking))
582-
Opts.LinkMode = SILOptions::LinkNone;
583-
else if (A->getOption().matches(OPT_sil_link_all))
584-
Opts.LinkMode = SILOptions::LinkAll;
585-
else
586-
llvm_unreachable("Unknown SIL linking option!");
587-
}
579+
if (const Arg *A = Args.getLastArg(OPT_disable_sil_linking))
580+
Opts.LinkMode = SILOptions::LinkNone;
588581

589582
if (Args.hasArg(OPT_sil_merge_partial_modules))
590583
Opts.MergePartialModules = true;

lib/FrontendTool/FrontendTool.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -980,13 +980,6 @@ static bool performCompile(CompilerInstance &Instance,
980980
return false;
981981
}
982982

983-
/// If we are asked to link all, link all.
984-
static void linkAllIfNeeded(const CompilerInvocation &Invocation,
985-
SILModule *SM) {
986-
if (Invocation.getSILOptions().LinkMode == SILOptions::LinkAll)
987-
performSILLinking(SM);
988-
}
989-
990983
/// Perform "stable" optimizations that are invariant across compiler versions.
991984
static bool performMandatorySILPasses(CompilerInvocation &Invocation,
992985
SILModule *SM,
@@ -1008,8 +1001,6 @@ static bool performMandatorySILPasses(CompilerInvocation &Invocation,
10081001
return true;
10091002
}
10101003

1011-
linkAllIfNeeded(Invocation, SM);
1012-
10131004
if (Invocation.getSILOptions().MergePartialModules)
10141005
SM->linkAllFromCurrentModule();
10151006
return false;
@@ -1211,12 +1202,10 @@ static bool performCompileStepsPostSILGen(
12111202

12121203
// We've been told to emit SIL after SILGen, so write it now.
12131204
if (Action == FrontendOptions::ActionType::EmitSILGen) {
1214-
linkAllIfNeeded(Invocation, SM.get());
12151205
return writeSIL(*SM, PSPs, Instance, Invocation);
12161206
}
12171207

12181208
if (Action == FrontendOptions::ActionType::EmitSIBGen) {
1219-
linkAllIfNeeded(Invocation, SM.get());
12201209
serializeSIB(SM.get(), PSPs, Instance.getASTContext(), MSF);
12211210
return Context.hadError();
12221211
}

lib/SIL/SILModule.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,6 @@ void SILModule::linkAllFromCurrentModule() {
561561
/*PrimaryFile=*/nullptr);
562562
}
563563

564-
void SILModule::linkAllWitnessTables() {
565-
getSILLoader()->getAllWitnessTables();
566-
}
567-
568-
void SILModule::linkAllVTables() {
569-
getSILLoader()->getAllVTables();
570-
}
571-
572564
void SILModule::invalidateSILLoaderCaches() {
573565
getSILLoader()->invalidateCaches();
574566
}

lib/SILOptimizer/UtilityPasses/Link.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ using namespace swift;
2020
// Top Level Driver
2121
//===----------------------------------------------------------------------===//
2222

23-
void swift::performSILLinking(SILModule *M) {
24-
for (auto &Fn : *M)
25-
M->linkFunction(&Fn, SILModule::LinkingMode::LinkAll);
26-
27-
M->linkAllWitnessTables();
28-
M->linkAllVTables();
29-
}
30-
31-
3223
namespace {
3324

3425
/// Copies code from the standard library into the user program to enable

test/SIL/Serialization/generic_shared_function.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module -o %t %S/Inputs/generic_shared_function_helper.sil -module-name SILSource
3-
// RUN: %target-swift-frontend -emit-module -o %t -I %t -primary-file %s -module-name main -sil-link-all
3+
// RUN: %target-swift-frontend -emit-module -o %t -I %t -primary-file %s -module-name main
44

55
// Just don't crash when using -primary-file and re-serializing a
66
// generic shared_external SIL function.

0 commit comments

Comments
 (0)