Merge pull request #67994 from artemcm/NoPostSerializationOptimizationForExplicitInterface

Enable `StopOptimizationAfterSerialization` SIL Option for explicit `-compile-module-from-interface` tasks
This commit is contained in:
Artem Chikin
2023-08-18 15:40:28 -07:00
committed by GitHub
2 changed files with 24 additions and 1 deletions

View File

@@ -1945,7 +1945,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
// If we're only emitting a module, stop optimizations once we've serialized
// the SIL for the module.
if (FEOpts.RequestedAction == FrontendOptions::ActionType::EmitModuleOnly)
if (FEOpts.RequestedAction == FrontendOptions::ActionType::EmitModuleOnly ||
FEOpts.RequestedAction == FrontendOptions::ActionType::CompileModuleFromInterface)
Opts.StopOptimizationAfterSerialization = true;
// Propagate the typechecker's understanding of

View File

@@ -0,0 +1,22 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/Foo)
// RUN: %target-swift-frontend -swift-version 5 -O -emit-module %s -emit-module-path %t/Foo/Foo.swiftmodule -module-name Foo -emit-module-interface-path %t/Foo/Foo.swiftinterface -enable-library-evolution
// RUN: %target-swift-frontend -swift-version 5 -compile-module-from-interface -module-name Foo -o %t/Foo/FooFromInterface.swiftmodule -O -Xllvm -sil-print-after=inline %t/Foo/Foo.swiftinterface 2>&1 | %FileCheck %s --check-prefix SKIPPING
// This test ensures that we don't run the Perf Inliner after serializing a
// module, if we're stopping optimizations after serializing.
@inline(never)
public func _blackHole(_ x: Int) {}
@inlinable
public func inlinableFunction(_ x: Int) -> Int {
return x + 1
}
public func caller() {
_blackHole(inlinableFunction(20))
}
// SKIPPING-NOT: *** SIL function after {{.*}}, stage MidLevel,Function, pass {{.*}}: PerfInliner (inline)