Skip to content

Commit e6361ae

Browse files
committed
Enable 'StopOptimizationAfterSerialization' SIL Option for explicit
'-compile-module-from-interface' tasks
1 parent 48695c6 commit e6361ae

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
19411941

19421942
// If we're only emitting a module, stop optimizations once we've serialized
19431943
// the SIL for the module.
1944-
if (FEOpts.RequestedAction == FrontendOptions::ActionType::EmitModuleOnly)
1944+
if (FEOpts.RequestedAction == FrontendOptions::ActionType::EmitModuleOnly ||
1945+
FEOpts.RequestedAction == FrontendOptions::ActionType::CompileModuleFromInterface)
19451946
Opts.StopOptimizationAfterSerialization = true;
19461947

19471948
// Propagate the typechecker's understanding of
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/Foo)
3+
// 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
4+
5+
// 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
6+
7+
// This test ensures that we don't run the Perf Inliner after serializing a
8+
// module, if we're stopping optimizations after serializing.
9+
10+
@inline(never)
11+
public func _blackHole(_ x: Int) {}
12+
13+
@inlinable
14+
public func inlinableFunction(_ x: Int) -> Int {
15+
return x + 1
16+
}
17+
18+
public func caller() {
19+
_blackHole(inlinableFunction(20))
20+
}
21+
22+
// SKIPPING-NOT: *** SIL function after {{.*}}, stage MidLevel,Function, pass {{.*}}: PerfInliner (inline)

0 commit comments

Comments
 (0)