Skip to content

Commit 875cd65

Browse files
author
Harlan Haskins
authored
[ParseableInterfaces] Preserve -enforce-exclusivity in interface args (#23281)
By default, we compile the standard library with `-enforce-exclusivity=unchecked`. If we don't preserve this argument, then the standard library compiled from an interface includes exclusivity enforcement, which pessimizes inlining those functions, which decreases performance for clients. Part of rdar://46431767
1 parent 72f1504 commit 875cd65

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

include/swift/Option/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,8 @@ def index_ignore_system_modules : Flag<["-"], "index-ignore-system-modules">,
856856
HelpText<"Avoid indexing system modules">;
857857

858858
def enforce_exclusivity_EQ : Joined<["-"], "enforce-exclusivity=">,
859-
Flags<[FrontendOption]>, MetaVarName<"<enforcement>">,
859+
Flags<[FrontendOption, ParseableInterfaceOption]>,
860+
MetaVarName<"<enforcement>">,
860861
HelpText<"Enforce law of exclusivity">;
861862

862863
def working_directory : Separate<["-"], "working-directory">,

test/ParseableInterface/option-preservation.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-frontend -enable-resilience -emit-parseable-module-interface-path %t.swiftinterface -module-name t %s -emit-module -o /dev/null -Onone
3+
// RUN: %target-swift-frontend -enable-resilience -emit-parseable-module-interface-path %t.swiftinterface -module-name t %s -emit-module -o /dev/null -Onone -enforce-exclusivity=unchecked
44
// RUN: %FileCheck %s < %t.swiftinterface -check-prefix=CHECK-SWIFTINTERFACE
55
//
66
// CHECK-SWIFTINTERFACE: swift-module-flags:
77
// CHECK-SWIFTINTERFACE-SAME: -enable-resilience
88
// CHECK-SWIFTINTERFACE-SAME: -Onone
9+
// CHECK-SWIFTINTERFACE-SAME: -enforce-exclusivity=unchecked
910

1011
// Make sure flags show up when filelists are enabled
1112

12-
// RUN: %target-build-swift %s -driver-filelist-threshold=0 -emit-parseable-module-interface -o %t/foo -module-name foo -module-link-name fooCore -force-single-frontend-invocation -Ounchecked 2>&1
13+
// RUN: %target-build-swift %s -driver-filelist-threshold=0 -emit-parseable-module-interface -o %t/foo -module-name foo -module-link-name fooCore -force-single-frontend-invocation -Ounchecked -enforce-exclusivity=unchecked 2>&1
1314
// RUN: %FileCheck %s < %t/foo.swiftinterface --check-prefix CHECK-FILELIST-INTERFACE
1415

1516
// CHECK-FILELIST-INTERFACE: swift-module-flags:
1617
// CHECK-FILELIST-INTERFACE-SAME: -target
1718
// CHECK-FILELIST-INTERFACE-SAME: -module-link-name fooCore
19+
// CHECK-FILELIST-INTERFACE-SAME: -enforce-exclusivity=unchecked
1820
// CHECK-FILELIST-INTERFACE-SAME: -Ounchecked
1921
// CHECK-FILELIST-INTERFACE-SAME: -module-name foo
2022

0 commit comments

Comments
 (0)