File tree Expand file tree Collapse file tree 6 files changed +18
-43
lines changed Expand file tree Collapse file tree 6 files changed +18
-43
lines changed Original file line number Diff line number Diff line change @@ -561,10 +561,6 @@ class SILModule {
561
561
// / i.e. it can be linked by linkFunction.
562
562
bool hasFunction (StringRef Name);
563
563
564
- // / Link all definitions in all segments that are logically part of
565
- // / the same AST module.
566
- void linkAllFromCurrentModule ();
567
-
568
564
// / Look up the SILWitnessTable representing the lowering of a protocol
569
565
// / conformance, and collect the substitutions to apply to the referenced
570
566
// / witnesses, if any.
Original file line number Diff line number Diff line change @@ -982,22 +982,17 @@ void CompilerInstance::freeASTContext() {
982
982
// / Perform "stable" optimizations that are invariant across compiler versions.
983
983
static bool performMandatorySILPasses (CompilerInvocation &Invocation,
984
984
SILModule *SM) {
985
+ // Don't run diagnostic passes at all when merging modules.
985
986
if (Invocation.getFrontendOptions ().RequestedAction ==
986
987
FrontendOptions::ActionType::MergeModules) {
987
- // Don't run diagnostic passes at all.
988
- } else if (!Invocation.getDiagnosticOptions ().SkipDiagnosticPasses ) {
989
- if (runSILDiagnosticPasses (*SM))
990
- return true ;
991
- } else {
988
+ return false ;
989
+ }
990
+ if (Invocation.getDiagnosticOptions ().SkipDiagnosticPasses ) {
992
991
// Even if we are not supposed to run the diagnostic passes, we still need
993
992
// to run the ownership evaluator.
994
- if (runSILOwnershipEliminatorPass (*SM))
995
- return true ;
993
+ return runSILOwnershipEliminatorPass (*SM);
996
994
}
997
-
998
- if (Invocation.getSILOptions ().MergePartialModules )
999
- SM->linkAllFromCurrentModule ();
1000
- return false ;
995
+ return runSILDiagnosticPasses (*SM);
1001
996
}
1002
997
1003
998
// / Perform SIL optimization passes if optimizations haven't been disabled.
Original file line number Diff line number Diff line change @@ -427,11 +427,6 @@ bool SILModule::hasFunction(StringRef Name) {
427
427
return getSILLoader ()->hasSILFunction (Name);
428
428
}
429
429
430
- void SILModule::linkAllFromCurrentModule () {
431
- getSILLoader ()->getAllForModule (getSwiftModule ()->getName (),
432
- /* PrimaryFile=*/ nullptr );
433
- }
434
-
435
430
void SILModule::invalidateSILLoaderCaches () {
436
431
getSILLoader ()->invalidateCaches ();
437
432
}
Original file line number Diff line number Diff line change @@ -1928,12 +1928,12 @@ ASTLoweringRequest::evaluate(Evaluator &evaluator,
1928
1928
}
1929
1929
1930
1930
// Also make sure to process any intermediate files that may contain SIL.
1931
- bool hasSIB = llvm::any_of (desc. getFiles (), []( const FileUnit *File) -> bool {
1932
- auto *SASTF = dyn_cast<SerializedASTFile>( File);
1933
- return SASTF && SASTF-> isSIB ( );
1934
- });
1935
- if (hasSIB ) {
1936
- auto primary = desc.context .dyn_cast <FileUnit *>();
1931
+ bool shouldDeserialize =
1932
+ llvm::any_of (desc. getFiles (), []( const FileUnit * File) -> bool {
1933
+ return isa<SerializedASTFile>(File );
1934
+ });
1935
+ if (shouldDeserialize ) {
1936
+ auto * primary = desc.context .dyn_cast <FileUnit *>();
1937
1937
silMod->getSILLoader ()->getAllForModule (silMod->getSwiftModule ()->getName (),
1938
1938
primary);
1939
1939
}
Original file line number Diff line number Diff line change @@ -275,16 +275,10 @@ int main(int argc, char **argv) {
275
275
auto SILMod = performASTLowering (CI.getMainModule (), CI.getSILTypes (),
276
276
CI.getSILOptions ());
277
277
278
- // Load the SIL if we have a non-SIB serialized module. SILGen handles SIB for
279
- // us.
278
+ // Load in all the SIL if we're allowed to.
280
279
if (Invocation.hasSerializedAST () && !extendedInfo.isSIB ()) {
281
- auto SL = SerializedSILLoader::create (
282
- CI.getASTContext (), SILMod.get (), nullptr );
283
-
284
- if (DisableSILLinking)
285
- SL->getAllForModule (CI.getMainModule ()->getName (), nullptr );
286
- else
287
- SL->getAll ();
280
+ if (!DisableSILLinking)
281
+ SILMod->getSILLoader ()->getAll ();
288
282
}
289
283
290
284
if (CommandLineFunctionNames.empty () && FunctionNameFile.empty ())
Original file line number Diff line number Diff line change @@ -464,15 +464,10 @@ int main(int argc, char **argv) {
464
464
}
465
465
SILMod->setSerializeSILAction ([]{});
466
466
467
- // Load the SIL if we have a non-SIB serialized module. SILGen handles SIB for
468
- // us.
467
+ // Load in all the SIL if we're allowed to.
469
468
if (Invocation.hasSerializedAST () && !extendedInfo.isSIB ()) {
470
- auto SL = SerializedSILLoader::create (
471
- CI.getASTContext (), SILMod.get (), nullptr );
472
- if (DisableSILLinking)
473
- SL->getAllForModule (CI.getMainModule ()->getName (), nullptr );
474
- else
475
- SL->getAll ();
469
+ if (!DisableSILLinking)
470
+ SILMod->getSILLoader ()->getAll ();
476
471
}
477
472
478
473
if (!RemarksFilename.empty ()) {
You can’t perform that action at this time.
0 commit comments