Skip to content

Revert "Revert "[ParseableInterfaces] Stop explicitly optimizing cached modules"" #23936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions lib/Frontend/ParseableInterfaceModuleLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,6 @@ class swift::ParseableInterfaceBuilder {
return;
}

// Optimize emitted modules. This has to happen after we parse arguments,
// because parseSILOpts would override the current optimization mode.
subInvocation.getSILOptions().OptMode = OptimizationMode::ForSpeed;

// Build the .swiftmodule; this is a _very_ abridged version of the logic
// in performCompile in libFrontendTool, specialized, to just the one
// module-serialization task we're trying to do here.
Expand Down
16 changes: 16 additions & 0 deletions test/ParseableInterface/optimization-level.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Lib.swiftinterface %s -O
// 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

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Lib.swiftinterface %s -Onone
// 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

// This is a bit of an implementation detail, but we want to make sure
// optimization passes don't run when compiling a .swiftinterface that was
// generated with -Onone.

// OPT: EagerSpecializer
// UNOPT-NOT: EagerSpecializer
public func f() {}

2 changes: 1 addition & 1 deletion test/SourceKit/InterfaceGen/gen_swift_module.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ func f(s : inout [Int]) {
// Test we can generate the interface of a module loaded via a .swiftinterface file correctly

// RUN: %empty-directory(%t.mod)
// 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
// 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
// RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod -module-cache-path %t.mod/mcp > %t.response
// RUN: diff -u %s.from_swiftinterface.response %t.response