SIL: Remove unnecessary performSILLinking() calls from immediate mode and REPL

This commit is contained in:
Slava Pestov
2018-04-06 16:48:58 -07:00
parent 653ce6162e
commit cc586594d1
5 changed files with 4 additions and 12 deletions

View File

@@ -59,8 +59,7 @@ namespace swift {
/// serialized modules.
///
/// \param M the SILModule on which to operate
/// \param LinkAll when true, always link. For testing purposes.
void performSILLinking(SILModule *M, bool LinkAll = false);
void performSILLinking(SILModule *M);
/// \brief Convert SIL to a lowered form suitable for IRGen.
void runSILLoweringPasses(SILModule &M);

View File

@@ -984,7 +984,7 @@ static bool performCompile(CompilerInstance &Instance,
static void linkAllIfNeeded(const CompilerInvocation &Invocation,
SILModule *SM) {
if (Invocation.getSILOptions().LinkMode == SILOptions::LinkAll)
performSILLinking(SM, true);
performSILLinking(SM);
}
/// Perform "stable" optimizations that are invariant across compiler versions.

View File

@@ -253,7 +253,6 @@ bool swift::immediate::IRGenImportedModules(
std::unique_ptr<SILModule> SILMod = performSILGeneration(import,
CI.getSILOptions());
performSILLinking(SILMod.get());
if (runSILDiagnosticPasses(*SILMod)) {
hadError = true;
break;

View File

@@ -869,7 +869,6 @@ private:
if (!CI.getASTContext().hadError()) {
sil = performSILGeneration(REPLInputFile, CI.getSILOptions(),
RC.CurIRGenElem);
performSILLinking(sil.get());
runSILDiagnosticPasses(*sil);
runSILLoweringPasses(*sil);
}

View File

@@ -20,14 +20,9 @@ using namespace swift;
// Top Level Driver
//===----------------------------------------------------------------------===//
void swift::performSILLinking(SILModule *M, bool LinkAll) {
auto LinkMode = LinkAll? SILModule::LinkingMode::LinkAll :
SILModule::LinkingMode::LinkNormal;
void swift::performSILLinking(SILModule *M) {
for (auto &Fn : *M)
M->linkFunction(&Fn, LinkMode);
if (!LinkAll)
return;
M->linkFunction(&Fn, SILModule::LinkingMode::LinkAll);
M->linkAllWitnessTables();
M->linkAllVTables();