Skip to content

Commit 753d545

Browse files
authored
Merge pull request #67994 from artemcm/NoPostSerializationOptimizationForExplicitInterface
Enable `StopOptimizationAfterSerialization` SIL Option for explicit `-compile-module-from-interface` tasks
2 parents c7538c0 + e6361ae commit 753d545

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
@@ -1945,7 +1945,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
19451945

19461946
// If we're only emitting a module, stop optimizations once we've serialized
19471947
// the SIL for the module.
1948-
if (FEOpts.RequestedAction == FrontendOptions::ActionType::EmitModuleOnly)
1948+
if (FEOpts.RequestedAction == FrontendOptions::ActionType::EmitModuleOnly ||
1949+
FEOpts.RequestedAction == FrontendOptions::ActionType::CompileModuleFromInterface)
19491950
Opts.StopOptimizationAfterSerialization = true;
19501951

19511952
// 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)