[SR-3063] Suppress SIL transforms when merging modules.

This commit is contained in:
John McCall
2017-07-26 21:19:07 -04:00
parent 6b2a92222e
commit dda3a3827c
9 changed files with 31 additions and 11 deletions

View File

@@ -816,7 +816,9 @@ static bool performCompile(CompilerInstance &Instance,
}
// Perform "stable" optimizations that are invariant across compiler versions.
if (!Invocation.getDiagnosticOptions().SkipDiagnosticPasses) {
if (Action == FrontendOptions::MergeModules) {
// Don't run diagnostic passes at all.
} else if (!Invocation.getDiagnosticOptions().SkipDiagnosticPasses) {
if (runSILDiagnosticPasses(*SM))
return true;
@@ -846,8 +848,9 @@ static bool performCompile(CompilerInstance &Instance,
// These may change across compiler versions.
{
SharedTimer timer("SIL optimization");
if (Invocation.getSILOptions().Optimization >
SILOptions::SILOptMode::None) {
if (Action != FrontendOptions::MergeModules &&
Invocation.getSILOptions().Optimization >
SILOptions::SILOptMode::None) {
runSILOptPreparePasses(*SM);
@@ -936,7 +939,8 @@ static bool performCompile(CompilerInstance &Instance,
serialize(DC, serializationOpts, SM.get());
}
if (Action == FrontendOptions::EmitModuleOnly) {
if (Action == FrontendOptions::MergeModules ||
Action == FrontendOptions::EmitModuleOnly) {
if (shouldIndex) {
if (emitIndexData(PrimarySourceFile, Invocation, Instance))
return true;