Skip to content

Commit f519532

Browse files
authored
Merge pull request #11995 from slavapestov/reapply-merge-partial-sil-modules-again
Reapply "merge partial SIL modules" again
2 parents 8685141 + 731a2f2 commit f519532

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

lib/Driver/ToolChains.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,14 @@ ToolChain::constructInvocation(const MergeModuleJobAction &job,
687687
// serialized ASTs.
688688
Arguments.push_back("-parse-as-library");
689689

690+
// Merge serialized SIL from partial modules.
691+
Arguments.push_back("-sil-merge-partial-modules");
692+
693+
// Disable SIL optimization passes; we've already optimized the code in each
694+
// partial mode.
695+
Arguments.push_back("-disable-diagnostic-passes");
696+
Arguments.push_back("-disable-sil-perf-optzns");
697+
690698
addCommonFrontendArgs(*this, context.OI, context.Output, context.Args,
691699
Arguments);
692700
context.Args.AddLastArg(Arguments, options::OPT_import_objc_header);

lib/SIL/SILVerifier.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4516,13 +4516,20 @@ void SILModule::verify() const {
45164516
// Uniquing set to catch symbol name collisions.
45174517
llvm::StringSet<> symbolNames;
45184518

4519+
// When merging partial modules, we only link functions from the current
4520+
// module, without enabling "LinkAll" mode or running the SILLinker pass;
4521+
// in this case, we need to relax some of the checks.
4522+
bool SingleFunction = false;
4523+
if (getOptions().MergePartialModules)
4524+
SingleFunction = true;
4525+
45194526
// Check all functions.
45204527
for (const SILFunction &f : *this) {
45214528
if (!symbolNames.insert(f.getName()).second) {
45224529
llvm::errs() << "Symbol redefined: " << f.getName() << "!\n";
45234530
assert(false && "triggering standard assertion failure routine");
45244531
}
4525-
f.verify(/*SingleFunction=*/false);
4532+
f.verify(SingleFunction);
45264533
}
45274534

45284535
// Check all globals.

lib/Sema/CodeSynthesis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ void swift::maybeAddAccessorsToVariable(VarDecl *var, TypeChecker &TC) {
16991699
getter->setAccess(var->getFormalAccess());
17001700

17011701
// Make a setter if the behavior property has one.
1702-
if (auto valueSetter = valueProp->getSetter()) {
1702+
if (valueProp->getSetter()) {
17031703
ParamDecl *newValueParam = nullptr;
17041704
setter = createSetterPrototype(var, newValueParam, TC);
17051705
if (mightBeMutating && valueProp->isSetterMutating())
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %empty-directory(%t)
2+
3+
// RUN: %target-swift-frontend -emit-module -primary-file %s -module-name test -o %t/partial.swiftmodule -O
4+
5+
// RUN: %target-swift-frontend -emit-module %t/partial.swiftmodule -module-name test -sil-merge-partial-modules -disable-diagnostic-passes -disable-sil-perf-optzns -o %t/test.swiftmodule
6+
7+
public func makeMirror(object x: Any) -> Mirror {
8+
return Mirror(reflecting: x)
9+
}

validation-test/Evolution/test_function_change_transparent_body.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
// RUN: %target-resilience-test-wmo
1+
// RUN: %target-resilience-test
22
// REQUIRES: executable_test
33

4-
// FIXME: shouldn't need -whole-module-optimization here; we need to fix the
5-
// frontend to merge serialized SIL functions from different translation units
6-
74
import StdlibUnittest
85
import function_change_transparent_body
96

0 commit comments

Comments
 (0)