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. /// serialized modules.
/// ///
/// \param M the SILModule on which to operate /// \param M the SILModule on which to operate
/// \param LinkAll when true, always link. For testing purposes. void performSILLinking(SILModule *M);
void performSILLinking(SILModule *M, bool LinkAll = false);
/// \brief Convert SIL to a lowered form suitable for IRGen. /// \brief Convert SIL to a lowered form suitable for IRGen.
void runSILLoweringPasses(SILModule &M); void runSILLoweringPasses(SILModule &M);

View File

@@ -984,7 +984,7 @@ static bool performCompile(CompilerInstance &Instance,
static void linkAllIfNeeded(const CompilerInvocation &Invocation, static void linkAllIfNeeded(const CompilerInvocation &Invocation,
SILModule *SM) { SILModule *SM) {
if (Invocation.getSILOptions().LinkMode == SILOptions::LinkAll) if (Invocation.getSILOptions().LinkMode == SILOptions::LinkAll)
performSILLinking(SM, true); performSILLinking(SM);
} }
/// Perform "stable" optimizations that are invariant across compiler versions. /// 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, std::unique_ptr<SILModule> SILMod = performSILGeneration(import,
CI.getSILOptions()); CI.getSILOptions());
performSILLinking(SILMod.get());
if (runSILDiagnosticPasses(*SILMod)) { if (runSILDiagnosticPasses(*SILMod)) {
hadError = true; hadError = true;
break; break;

View File

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

View File

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