@@ -15,7 +15,7 @@ import Foundation
15
15
16
16
// OPT-LABEL: define{{.*}} @{{.*}}dontHoist
17
17
// OPT-NOT: S10Foundation11MeasurementVySo17NSUnitTemperature
18
- // OPT: call {{.*}} @_swift_stdlib_operatingSystemVersion (
18
+ // OPT: call {{.*}} @"$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF" (
19
19
// OPT: s10Foundation11MeasurementVySo17NSUnitTemperature
20
20
21
21
public func dontHoist( ) {
@@ -28,8 +28,15 @@ public func dontHoist() {
28
28
}
29
29
30
30
31
+ // Now that _isOSVersionAtLeast is no longer inlinable, we do still
32
+ // mark it as _effects(readnone).
33
+ // This means that unlike in the past the optimizer can now only coalesce
34
+ // availability checks with the same availability. It does not determine,
35
+ // for example, that a check for iOS 10 is sufficient to guarantee that a check
36
+ // for iOS 9 will also succeed.
37
+
31
38
// With optimizations on, multiple #availability checks should generate only
32
- // a single call into _swift_stdlib_operatingSystemVersion .
39
+ // a single call into _isOSVersionAtLeast .
33
40
34
41
// CHECK-LABEL: define{{.*}} @{{.*}}multipleAvailabilityChecks
35
42
// CHECK: call swiftcc i1 @"$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF"(
@@ -38,17 +45,17 @@ public func dontHoist() {
38
45
// CHECK: ret void
39
46
40
47
// OPT-LABEL: define{{.*}} @{{.*}}multipleAvailabilityChecks
41
- // OPT: call {{.*}} @_swift_stdlib_operatingSystemVersion
42
- // OPT-NOT: call {{.*}} @_swift_stdlib_operatingSystemVersion
48
+ // OPT: call {{.*}} @"$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF"
49
+ // OPT-NOT: call {{.*}} @"$ss26_stdlib_isOSVersionAtLeastyBi1_Bw_BwBwtF"
43
50
// OPT: ret void
44
51
public func multipleAvailabilityChecks( ) {
45
52
if #available( OSX 10 . 12 , iOS 10 . 0 , watchOS 3 . 0 , tvOS 10 . 0 , * ) {
46
53
print ( " test one " )
47
54
}
48
- if #available( OSX 10 . 11 , iOS 9 . 0 , watchOS 2 . 0 , tvOS 9 . 0 , * ) {
55
+ if #available( OSX 10 . 12 , iOS 10 . 0 , watchOS 3 . 0 , tvOS 10 . 0 , * ) {
49
56
print ( " test two " )
50
57
}
51
- if #available( OSX 10 . 10 , iOS 8 . 0 , watchOS 1 . 0 , tvOS 8 . 0 , * ) {
58
+ if #available( OSX 10 . 12 , iOS 10 . 0 , watchOS 3 . 0 , tvOS 10 . 0 , * ) {
52
59
print ( " test three " )
53
60
}
54
61
}
0 commit comments