Skip to content

Commit fd4eea9

Browse files
author
Harlan Haskins
authored
Merge pull request #23936 from harlanhaskins/optifreeze-again
Revert "Revert "[ParseableInterfaces] Stop explicitly optimizing cached modules""
2 parents 6ea773e + 0999bfe commit fd4eea9

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,6 @@ class swift::ParseableInterfaceBuilder {
537537
return;
538538
}
539539

540-
// Optimize emitted modules. This has to happen after we parse arguments,
541-
// because parseSILOpts would override the current optimization mode.
542-
subInvocation.getSILOptions().OptMode = OptimizationMode::ForSpeed;
543-
544540
// Build the .swiftmodule; this is a _very_ abridged version of the logic
545541
// in performCompile in libFrontendTool, specialized, to just the one
546542
// module-serialization task we're trying to do here.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Lib.swiftinterface %s -O
3+
// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/Lib.swiftinterface -Xllvm -sil-print-pass-name -o /dev/null 2>&1 | %FileCheck --check-prefix OPT %s
4+
5+
// RUN: %empty-directory(%t)
6+
// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Lib.swiftinterface %s -Onone
7+
// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/Lib.swiftinterface -Xllvm -sil-print-pass-name -o /dev/null 2>&1 | %FileCheck --check-prefix UNOPT %s
8+
9+
// This is a bit of an implementation detail, but we want to make sure
10+
// optimization passes don't run when compiling a .swiftinterface that was
11+
// generated with -Onone.
12+
13+
// OPT: EagerSpecializer
14+
// UNOPT-NOT: EagerSpecializer
15+
public func f() {}
16+

test/SourceKit/InterfaceGen/gen_swift_module.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ func f(s : inout [Int]) {
3030
// Test we can generate the interface of a module loaded via a .swiftinterface file correctly
3131

3232
// RUN: %empty-directory(%t.mod)
33-
// RUN: %swift -emit-module -o /dev/null -emit-parseable-module-interface-path %t.mod/swift_mod.swiftinterface %S/Inputs/swift_mod.swift -parse-as-library
33+
// RUN: %swift -emit-module -o /dev/null -emit-parseable-module-interface-path %t.mod/swift_mod.swiftinterface -O %S/Inputs/swift_mod.swift -parse-as-library
3434
// RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod -module-cache-path %t.mod/mcp > %t.response
3535
// RUN: diff -u %s.from_swiftinterface.response %t.response

0 commit comments

Comments
 (0)