Skip to content

Commit 9facbd4

Browse files
authored
Merge pull request #74567 from hborla/remove-disable-region-isolation
[Concurrency] Remove `-disable-region-based-isolation-with-strict-concurrency`.
2 parents 76d5dd4 + de78fd4 commit 9facbd4

30 files changed

+19
-88
lines changed

include/swift/Option/FrontendOptions.td

-5
Original file line numberDiff line numberDiff line change
@@ -1371,11 +1371,6 @@ def disable_experimental_parser_round_trip : Flag<["-"],
13711371
"disable-experimental-parser-round-trip">,
13721372
HelpText<"Disable round trip through the new swift parser">;
13731373

1374-
def disable_strict_concurrency_region_based_isolation : Flag<["-"],
1375-
"disable-region-based-isolation-with-strict-concurrency">,
1376-
HelpText<"Disable region based isolation when running with strict concurrency enabled. Only enabled with asserts">,
1377-
Flags<[HelpHidden]>;
1378-
13791374
def disable_transferring_args_and_results_with_region_isolation : Flag<["-"],
13801375
"disable-transferring-args-and-results-with-region-based-isolation">,
13811376
HelpText<"Disable transferring args and results when region based isolation is enabled. Only enabled with asserts">,

lib/DriverTool/sil_opt_main.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,6 @@ struct SILOptOptions {
571571
"Xcc",
572572
llvm::cl::desc("option to pass to clang"));
573573

574-
llvm::cl::opt<bool> DisableRegionBasedIsolationWithStrictConcurrency =
575-
llvm::cl::opt<bool>(
576-
"disable-region-based-isolation-with-strict-concurrency",
577-
llvm::cl::init(false));
578-
579574
llvm::cl::opt<std::string> SwiftVersionString = llvm::cl::opt<std::string>(
580575
"swift-version",
581576
llvm::cl::desc(
@@ -789,8 +784,7 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
789784

790785
// If we have strict concurrency set as a feature and were told to turn off
791786
// region based isolation... do so now.
792-
if (Invocation.getLangOptions().hasFeature(Feature::StrictConcurrency) &&
793-
!options.DisableRegionBasedIsolationWithStrictConcurrency) {
787+
if (Invocation.getLangOptions().hasFeature(Feature::StrictConcurrency)) {
794788
Invocation.getLangOptions().enableFeature(Feature::RegionBasedIsolation);
795789
}
796790

lib/Frontend/CompilerInvocation.cpp

+1-10
Original file line numberDiff line numberDiff line change
@@ -1101,16 +1101,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
11011101
if (Opts.StrictConcurrencyLevel == StrictConcurrency::Complete) {
11021102
Opts.enableFeature(Feature::IsolatedDefaultValues);
11031103
Opts.enableFeature(Feature::GlobalConcurrency);
1104-
1105-
// If asserts are enabled, allow for region based isolation to be disabled
1106-
// with a flag. This is intended only to be used with tests.
1107-
bool enableRegionIsolation = true;
1108-
#ifndef NDEBUG
1109-
enableRegionIsolation =
1110-
!Args.hasArg(OPT_disable_strict_concurrency_region_based_isolation);
1111-
#endif
1112-
if (enableRegionIsolation)
1113-
Opts.enableFeature(Feature::RegionBasedIsolation);
1104+
Opts.enableFeature(Feature::RegionBasedIsolation);
11141105
}
11151106

11161107
Opts.WarnImplicitOverrides =

test/Concurrency/LLDBDebuggerFunctionActorExtension.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %target-swift-frontend -disable-availability-checking -debugger-support %s -emit-sil -o /dev/null -verify
22
// RUN: %target-swift-frontend -disable-availability-checking -debugger-support %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
3-
// RUN: %target-swift-frontend -disable-availability-checking -debugger-support %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
43
// RUN: %target-swift-frontend -disable-availability-checking -debugger-support %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
54

65
// REQUIRES: concurrency

test/Concurrency/actor_call_implicitly_async.swift

+4-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete- -disable-region-based-isolation-with-strict-concurrency
2-
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify
1+
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -enable-upcoming-feature InferSendableFromCaptures -parse-as-library %s -emit-sil -o /dev/null -verify
32

43
// REQUIRES: concurrency
54
// REQUIRES: asserts
@@ -291,35 +290,23 @@ func blender(_ peeler : () -> Void) {
291290

292291

293292
await wisk({})
294-
// expected-complete-warning@-1{{passing argument of non-sendable type '() -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
295-
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
296293
await wisk(1)
297294
await (peelBanana)()
298295
await (((((peelBanana)))))()
299296
await (((wisk)))((wisk)((wisk)(1)))
300297

301298
blender((peelBanana))
302-
// expected-warning@-1 {{converting function value of type '@BananaActor () -> ()' to '() -> Void' loses global actor 'BananaActor'}}
299+
// expected-warning@-1 {{converting function value of type '@BananaActor @Sendable () -> ()' to '() -> Void' loses global actor 'BananaActor'}}
303300

304301
await wisk(peelBanana)
305-
// expected-complete-warning@-1{{passing argument of non-sendable type '() -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
306-
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
307302

308303
await wisk(wisk)
309-
// expected-complete-warning@-1{{passing argument of non-sendable type '(Any) -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
310-
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
311304
await (((wisk)))(((wisk)))
312-
// expected-complete-warning@-1{{passing argument of non-sendable type '(Any) -> ()' into global actor 'BananaActor'-isolated context may introduce data races}}
313-
// expected-complete-note@-2{{a function type must be marked '@Sendable' to conform to 'Sendable'}}
314305

315306
await {wisk}()(1)
316307

317-
// FIXME: Poor diagnostic. The issue is that the invalid function conversion
318-
// to remove '@BananaActor' on 'wisk' cannot influence which solution is chosen.
319-
// So, the constraint system cannot determine whether the type of this expression
320-
// is '(Any) -> Void' or '@BananaActor (Any) -> Void'.
321-
await (true ? wisk : {n in return})(1)
322-
// expected-error@-1 {{type of expression is ambiguous without a type annotation}}
308+
(true ? wisk : {n in return})(1)
309+
// expected-warning@-1 {{converting function value of type '@BananaActor @Sendable (Any) -> ()' to '(Any) -> ()' loses global actor 'BananaActor'; this is an error in the Swift 6 language mode}}
323310
}
324311

325312
actor Chain {

test/Concurrency/actor_inout_isolation.swift

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix minimal-targeted- -disable-region-based-isolation-with-strict-concurrency
2-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-complete-tns- -verify-additional-prefix targeted-complete- -verify-additional-prefix minimal-targeted- -strict-concurrency=targeted -disable-region-based-isolation-with-strict-concurrency
3-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-complete-tns- -verify-additional-prefix targeted-complete- -verify-additional-prefix complete-tns- -verify-additional-prefix complete- -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
1+
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix minimal-
42
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-complete-tns- -verify-additional-prefix complete-tns- -strict-concurrency=complete
53

64
// REQUIRES: concurrency
@@ -101,7 +99,7 @@ extension TestActor {
10199

102100
// external class method call
103101
@available(SwiftStdlib 5.1, *)
104-
class NonAsyncClass { // expected-targeted-complete-note {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
102+
class NonAsyncClass {
105103
// expected-targeted-complete-tns-note @-1 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
106104
// expected-tns-note @-2 {{class 'NonAsyncClass' does not conform to the 'Sendable' protocol}}
107105
func modifyOtherAsync(_ other : inout Int) async {
@@ -124,7 +122,6 @@ extension TestActor {
124122
// expected-targeted-complete-tns-warning @-1 {{non-sendable type 'NonAsyncClass' exiting actor-isolated context in call to non-isolated instance method 'modifyOtherAsync' cannot cross actor boundary}}
125123
await other.modifyOtherAsync(&value2)
126124
// expected-error @-1 {{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
127-
// expected-targeted-complete-warning @-2 {{passing argument of non-sendable type 'NonAsyncClass' outside of actor-isolated context may introduce data races}}
128125

129126
await otherCurry(&value1)
130127
// expected-error @-1 {{actor-isolated property 'value1' cannot be passed 'inout' to 'async' function call}}
@@ -134,13 +131,11 @@ extension TestActor {
134131
}
135132

136133
func callMutatingFunctionOnStruct() async {
137-
// expected-targeted-complete-warning @+4 {{passing argument of non-sendable type 'inout Point' outside of actor-isolated context may introduce data races}}
138134
// expected-error@+3:20{{cannot call mutating async function 'setComponents(x:y:)' on actor-isolated property 'position'}}
139135
// expected-error@+2:38{{actor-isolated property 'nextPosition' cannot be passed 'inout' to 'async' function call}}
140136
// expected-error@+1:58{{actor-isolated property 'nextPosition' cannot be passed 'inout' to 'async' function call}}
141137
await position.setComponents(x: &nextPosition.x, y: &nextPosition.y)
142138

143-
// expected-targeted-complete-warning @+4 {{passing argument of non-sendable type 'inout Point' outside of actor-isolated context may introduce data races}}
144139
// expected-error@+3:20{{cannot call mutating async function 'setComponents(x:y:)' on actor-isolated property 'position'}}
145140
// expected-error@+2:38{{actor-isolated property 'value1' cannot be passed 'inout' to 'async' function call}}
146141
// expected-error@+1:50{{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
@@ -224,7 +219,7 @@ struct MyGlobalActor {
224219
if #available(SwiftStdlib 5.1, *) {
225220
let _ = Task.detached { await { (_ foo: inout Int) async in foo += 1 }(&number) }
226221
// expected-error @-1 {{actor-isolated var 'number' cannot be passed 'inout' to 'async' function call}}
227-
// expected-minimal-targeted-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a non-isolated context}}
222+
// expected-minimal-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a non-isolated context}}
228223
// expected-complete-tns-error @-3 {{main actor-isolated var 'number' can not be used 'inout' from a non-isolated context}}
229224
}
230225

@@ -319,6 +314,5 @@ actor ProtectDictionary {
319314
func invalid() async {
320315
await dict[0].mutate()
321316
// expected-warning@-1 {{cannot call mutating async function 'mutate()' on actor-isolated property 'dict'; this is an error in the Swift 6 language mode}}
322-
// expected-targeted-complete-warning@-2 {{passing argument of non-sendable type 'inout Optional<Int>' outside of actor-isolated context may introduce data races}}
323317
}
324318
}

test/Concurrency/async_cancellation.swift

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify
2-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
3-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
42
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
53

64
// REQUIRES: concurrency

test/Concurrency/async_let_isolation.swift

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// Then with targeted.
55
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -verify-additional-prefix without-transferring-
66

7-
// Then with strict concurrency without region isolation.
8-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency -verify-additional-prefix without-transferring-
9-
107
// Then strict-concurrency with everything.
118
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix tns-
129

test/Concurrency/async_sequence_syntax.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify
22
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted
3-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
43
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete
54

65
// REQUIRES: concurrency

test/Concurrency/concurrency_warnings.swift

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/GlobalVariables.swiftmodule -module-name GlobalVariables %S/Inputs/GlobalVariables.swift -disable-availability-checking -parse-as-library
44

5-
// RUN: %target-swift-frontend -I %t -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify -disable-region-based-isolation-with-strict-concurrency
65
// RUN: %target-swift-frontend -I %t -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify
76

87
// REQUIRES: concurrency

test/Concurrency/concurrent_value_checking.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete- -disable-region-based-isolation-with-strict-concurrency
21
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete -parse-as-library %s -emit-sil -o /dev/null -verify
32

43
// REQUIRES: concurrency

test/Concurrency/concurrent_value_checking_objc.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete %s -emit-sil -o /dev/null -verify -disable-region-based-isolation-with-strict-concurrency
21
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete %s -emit-sil -o /dev/null -verify
32

43
// REQUIRES: concurrency

test/Concurrency/experimental_feature_strictconcurrency.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-feature StrictConcurrency -emit-sil -o /dev/null -verify %s -disable-region-based-isolation-with-strict-concurrency
2-
// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-feature StrictConcurrency=complete -emit-sil -o /dev/null -verify %s -disable-region-based-isolation-with-strict-concurrency
3-
// RUN: %target-swift-frontend -disable-availability-checking -enable-upcoming-feature StrictConcurrency -emit-sil -o /dev/null -verify %s -disable-region-based-isolation-with-strict-concurrency
4-
// RUN: %target-swift-frontend -disable-availability-checking -enable-upcoming-feature StrictConcurrency -emit-sil -o /dev/null -verify -verify-additional-prefix region-isolation- %s
1+
// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-feature StrictConcurrency -emit-sil -o /dev/null -verify %s
2+
// RUN: %target-swift-frontend -disable-availability-checking -enable-experimental-feature StrictConcurrency=complete -emit-sil -o /dev/null -verify %s
3+
// RUN: %target-swift-frontend -disable-availability-checking -enable-upcoming-feature StrictConcurrency -emit-sil -o /dev/null -verify %s
54

65
// REQUIRES: concurrency
76
// REQUIRES: asserts

test/Concurrency/global_actor_from_ordinary_context.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix minimal-and-targeted- -verify -disable-region-based-isolation-with-strict-concurrency
2-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix minimal-and-targeted- -verify -strict-concurrency=targeted -disable-region-based-isolation-with-strict-concurrency
3-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix complete-and-tns- -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency
1+
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix minimal-and-targeted- -verify
2+
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix minimal-and-targeted- -verify -strict-concurrency=targeted
43
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify-additional-prefix complete-and-tns- -verify -strict-concurrency=complete
54

65
// REQUIRES: concurrency

test/Concurrency/global_actor_function_types.swift

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
// Emit SIL with targeted concurrency.
88
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -verify-additional-prefix without-transferring-
99

10-
// Emit SIL with strict concurrency but without region based isolation
11-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix complete-tns- -verify-additional-prefix without-transferring- -disable-region-based-isolation-with-strict-concurrency
12-
1310
// Emit SIL with strict concurrency + region based isolation + transferring
1411
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix complete-tns-
1512

test/Concurrency/isolated_captures.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// RUN: %target-swift-frontend -verify -disable-availability-checking -strict-concurrency=complete -verify-additional-prefix complete- -emit-sil -o /dev/null %s -disable-region-based-isolation-with-strict-concurrency
21
// RUN: %target-swift-frontend -verify -disable-availability-checking -strict-concurrency=complete -verify-additional-prefix region-isolation- -emit-sil -o /dev/null %s
32

43
// REQUIRES: concurrency

test/Concurrency/isolated_parameters.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete %s -emit-sil -o /dev/null -verify -verify-additional-prefix complete- -disable-region-based-isolation-with-strict-concurrency
21
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=complete %s -emit-sil -o /dev/null -verify
32

43
// REQUIRES: asserts

test/Concurrency/issue-57376.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %target-swift-frontend -disable-availability-checking -strict-concurrency=targeted %s -emit-sil -o /dev/null -verify -verify-additional-prefix targeted-and-complete-
2-
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix tns- -verify-additional-prefix no-transferring-tns- -disable-region-based-isolation-with-strict-concurrency
32
// RUN: %target-swift-frontend -disable-availability-checking %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -verify-additional-prefix tns- -verify-additional-prefix transferring-tns-
43

54
// REQUIRES: concurrency

test/Concurrency/predates_concurrency_import.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/OtherActors.swiftmodule -module-name OtherActors %S/Inputs/OtherActors.swift -disable-availability-checking
55

66
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -parse-as-library -enable-upcoming-feature GlobalConcurrency
7-
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -disable-region-based-isolation-with-strict-concurrency -parse-as-library -enable-upcoming-feature GlobalConcurrency
8-
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -disable-region-based-isolation-with-strict-concurrency -parse-as-library -enable-upcoming-feature GlobalConcurrency
7+
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -strict-concurrency=targeted -parse-as-library -enable-upcoming-feature GlobalConcurrency
98
// RUN: %target-swift-frontend -I %t %s -emit-sil -o /dev/null -verify -strict-concurrency=complete -parse-as-library -enable-upcoming-feature GlobalConcurrency
109

1110
// REQUIRES: concurrency

0 commit comments

Comments
 (0)