Skip to content

Commit 373a3fe

Browse files
authored
Merge pull request #75185 from tshortli/revert-aeic-diagnose-unavailable-code-reached
SILGen/stdlib: Remove `_diagnoseUnavailableCodeReached_aeic()`
2 parents 7cc7e2b + 14200e4 commit 373a3fe

16 files changed

+25
-55
lines changed

include/swift/AST/ASTContext.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,10 +1499,6 @@ class ASTContext final {
14991499
/// The declared interface type of Builtin.TheTupleType.
15001500
BuiltinTupleType *getBuiltinTupleType();
15011501

1502-
/// The declaration for the `_diagnoseUnavailableCodeReached()` declaration
1503-
/// that ought to be used for the configured deployment target.
1504-
FuncDecl *getDiagnoseUnavailableCodeReachedDecl();
1505-
15061502
Type getNamedSwiftType(ModuleDecl *module, StringRef name);
15071503

15081504
/// Set the plugin loader.

include/swift/AST/KnownDecls.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ FUNC_DECL(DiagnoseUnexpectedNilOptional, "_diagnoseUnexpectedNilOptional")
7373
FUNC_DECL(DiagnoseUnexpectedEnumCase, "_diagnoseUnexpectedEnumCase")
7474
FUNC_DECL(DiagnoseUnexpectedEnumCaseValue, "_diagnoseUnexpectedEnumCaseValue")
7575
FUNC_DECL(DiagnoseUnavailableCodeReached, "_diagnoseUnavailableCodeReached")
76-
FUNC_DECL(DiagnoseUnavailableCodeReachedAEIC, "_diagnoseUnavailableCodeReached_aeic")
7776

7877
FUNC_DECL(GetErrorEmbeddedNSError, "_getErrorEmbeddedNSError")
7978

lib/AST/ASTContext.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6591,14 +6591,6 @@ BuiltinTupleType *ASTContext::getBuiltinTupleType() {
65916591
return result;
65926592
}
65936593

6594-
FuncDecl *ASTContext::getDiagnoseUnavailableCodeReachedDecl() {
6595-
// FIXME: Remove this with rdar://119892482
6596-
if (AvailabilityContext::forDeploymentTarget(*this).isContainedIn(
6597-
getSwift59Availability()))
6598-
return getDiagnoseUnavailableCodeReached();
6599-
return getDiagnoseUnavailableCodeReachedAEIC();
6600-
}
6601-
66026594
void ASTContext::setPluginLoader(std::unique_ptr<PluginLoader> loader) {
66036595
getImpl().Plugins = std::move(loader);
66046596
}

lib/SILGen/SILGenApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6397,7 +6397,7 @@ void SILGenFunction::emitApplyOfUnavailableCodeReached() {
63976397
return;
63986398

63996399
auto loc = RegularLocation::getAutoGeneratedLocation(F.getLocation());
6400-
FuncDecl *fd = getASTContext().getDiagnoseUnavailableCodeReachedDecl();
6400+
FuncDecl *fd = getASTContext().getDiagnoseUnavailableCodeReached();
64016401

64026402
if (!fd) {
64036403
// Broken stdlib?

lib/Sema/DerivedConformances.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ DerivedConformance::createBuiltinCall(ASTContext &ctx,
498498

499499
CallExpr *DerivedConformance::createDiagnoseUnavailableCodeReachedCallExpr(
500500
ASTContext &ctx) {
501-
FuncDecl *diagnoseDecl = ctx.getDiagnoseUnavailableCodeReachedDecl();
501+
FuncDecl *diagnoseDecl = ctx.getDiagnoseUnavailableCodeReached();
502502
assert(diagnoseDecl);
503503
auto diagnoseDeclRefExpr =
504504
new (ctx) DeclRefExpr(diagnoseDecl, DeclNameLoc(), true);
@@ -936,7 +936,7 @@ CaseStmt *DerivedConformance::unavailableEnumElementCaseStmt(
936936
// If the stdlib isn't new enough to contain the helper function for
937937
// diagnosing execution of unavailable code then just synthesize this case
938938
// normally.
939-
if (!C.getDiagnoseUnavailableCodeReachedDecl())
939+
if (!C.getDiagnoseUnavailableCodeReached())
940940
return nullptr;
941941

942942
auto createElementPattern = [&]() -> EnumElementPattern * {

stdlib/public/core/AssertCommon.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -338,17 +338,6 @@ internal func _diagnoseUnexpectedEnumCase<SwitchedValue>(
338338
@_semantics("unavailable_code_reached")
339339
@usableFromInline // COMPILER_INTRINSIC
340340
internal func _diagnoseUnavailableCodeReached() -> Never {
341-
_diagnoseUnavailableCodeReached_aeic()
342-
}
343-
344-
// FIXME: Remove this with rdar://119892482
345-
/// An `@_alwaysEmitIntoClient` variant of `_diagnoseUnavailableCodeReached()`.
346-
/// This is temporarily needed by the compiler to reference from back deployed
347-
/// clients.
348-
@_alwaysEmitIntoClient
349-
@inline(never)
350-
@_semantics("unavailable_code_reached")
351-
internal func _diagnoseUnavailableCodeReached_aeic() -> Never {
352341
_assertionFailure(
353342
"Fatal error", "Unavailable code reached", flags: _fatalErrorFlags())
354343
}

test/SILGen/unavailable_decl_optimization_stub.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public struct S {}
44

55
// CHECK-LABEL: sil{{.*}}@$s4Test15unavailableFuncAA1SVyF
6-
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
6+
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
77
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
88
// CHECK: function_ref @$s4Test1SVACycfC
99
// CHECK: } // end sil function '$s4Test15unavailableFuncAA1SVyF'

test/SILGen/unavailable_decl_optimization_stub_class.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ func foo() {}
77
public class ExplicitInitClass {
88
// ExplicitInitClass.s.getter
99
// CHECK-LABEL: sil{{.*}}@$s4Test17ExplicitInitClassC1sAA1SVvg
10-
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
10+
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
1111
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
1212
// CHECK: load
1313
// CHECK: } // end sil function '$s4Test17ExplicitInitClassC1sAA1SVvg'

test/SILGen/unavailable_decl_optimization_stub_macos.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
// REQUIRES: OS=macosx
77

88
// CHECK-LABEL: sil{{.*}}@$s4Test15unavailableFuncyyF
9-
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF : $@convention(thin) () -> Never
9+
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
1010
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF : $@convention(thin) () -> Never
1111
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
1212
// CHECK: } // end sil function '$s4Test15unavailableFuncyyF'
1313
@available(*, unavailable)
1414
public func unavailableFunc() {}
1515

1616
// CHECK-LABEL: sil{{.*}}@$s4Test24unavailableInlinableFuncyyF
17-
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF : $@convention(thin) () -> Never
17+
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
1818
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
1919
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
2020
// CHECK: } // end sil function '$s4Test24unavailableInlinableFuncyyF'
2121
@available(*, unavailable)
2222
@inlinable public func unavailableInlinableFunc() {}
2323

2424
// CHECK-LABEL: sil{{.*}}@$s4Test22unavailableOnMacOSFuncyyF
25-
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF : $@convention(thin) () -> Never
25+
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
2626
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF : $@convention(thin) () -> Never
2727
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
2828
// CHECK: } // end sil function '$s4Test22unavailableOnMacOSFuncyyF'
@@ -36,7 +36,7 @@ public func unavailableOnMacOSFunc() {}
3636
public func unavailableOnMacOSExtensionFunc() {}
3737

3838
// CHECK-LABEL: sil{{.*}}@$s4Test021unavailableOnMacOSAndD15OSExtensionFuncyyF
39-
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF : $@convention(thin) () -> Never
39+
// CHECK-SWIFT5_8: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
4040
// CHECK-SWIFT5_9: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyF : $@convention(thin) () -> Never
4141
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
4242
// CHECK: } // end sil function '$s4Test021unavailableOnMacOSAndD15OSExtensionFuncyyF'

test/SILGen/unavailable_decl_optimization_stub_macos_zippered.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// REQUIRES: OS=macosx
44

55
// CHECK-LABEL: sil{{.*}}@$s4Test15unavailableFuncyyF
6-
// CHECK: [[FNREF:%.*]] = function_ref @$ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF : $@convention(thin) () -> Never
6+
// CHECK: [[FNREF:%.*]] = function_ref @$ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb : $@convention(thin) () -> Never
77
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
88
// CHECK: } // end sil function '$s4Test15unavailableFuncyyF'
99
@available(*, unavailable)

test/SILGen/unavailable_decl_optimization_stub_objc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func foo() {}
1010
@objc public class C: NSObject {
1111
// C.__allocating_init()
1212
// CHECK-LABEL: sil{{.*}}@$s4Test1CCACycfC
13-
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
13+
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
1414
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
1515
// CHECK: {{%.*}} = function_ref @$s4Test1CCACycfcTD
1616
// CHECK: } // end sil function '$s4Test1CCACycfC'

test/SILGen/unavailable_decl_optimization_stub_opaque_type.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public struct S {}
55
extension S: P {}
66

77
// CHECK-LABEL: sil{{.*}}@$s4Test27unavailableOpaqueReturnFuncQryF
8-
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
8+
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
99
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
1010
// CHECK: function_ref @$s4Test1SVACycfC
1111
// CHECK: } // end sil function '$s4Test27unavailableOpaqueReturnFuncQryF'

test/SILGen/unavailable_decl_optimization_stub_protocol_witness.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extension EnumWithProtocolWitness: P {}
1717
// protocol witness for static P.requirement(_:) in conformance EnumWithProtocolWitness
1818
//
1919
// CHECK-LABEL: sil{{.*}}@$s4Test23EnumWithProtocolWitnessOAA1PA2aDP11requirementyxAA1SVFZTW
20-
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
20+
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
2121
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
2222
// CHECK: {{%.*}} = function_ref @$s4Test23EnumWithProtocolWitnessO11requirementyAcA1SVcACmF
2323
// CHECK: } // end sil function '$s4Test23EnumWithProtocolWitnessOAA1PA2aDP11requirementyxAA1SVFZTW'

test/SILGen/unavailable_decl_optimization_stub_struct.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public struct S {}
55
@available(*, unavailable)
66
public struct ImplicitInitStruct {
77
// CHECK-LABEL: sil hidden {{.*}} @$s4Test18ImplicitInitStructVACycfC
8-
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
8+
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
99
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
1010
// CHECK: return
1111
// CHECK: } // end sil function '$s4Test18ImplicitInitStructVACycfC'

test/SILOptimizer/unavailable_decl_optimization_stub.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public struct S {}
44

55
// CHECK-LABEL: sil{{.*}}@$s4Test15unavailableFuncAA1SVyF
6-
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss36_diagnoseUnavailableCodeReached_aeics5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
6+
// CHECK: [[FNREF:%.*]] = function_ref @$[[DIAGNOSEFN:(ss31_diagnoseUnavailableCodeReacheds5NeverOyF|ss31_diagnoseUnavailableCodeReacheds5NeverOyFTwb)]] : $@convention(thin) () -> Never
77
// CHECK-NEXT: [[APPLY:%.*]] = apply [[FNREF]]()
88
// CHECK-NEXT: unreachable
99
// CHECK-NEXT: } // end sil function '$s4Test15unavailableFuncAA1SVyF'

test/decl/enum/derived_hashable_equatable_macos.swift

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %target-swift-frontend -print-ast %s | %FileCheck %s --check-prefixes=CHECK,CHECK-PRE-SWIFT5_9
2-
// RUN: %target-swift-frontend -application-extension -print-ast %s | %FileCheck %s --check-prefixes=CHECK,CHECK-PRE-SWIFT5_9
3-
// RUN: %target-swift-frontend -target %target-cpu-apple-macosx10.51 -print-ast %s | %FileCheck %s --check-prefixes=CHECK,CHECK-PRE-SWIFT5_9
4-
// RUN: %target-swift-frontend -target %target-cpu-apple-macosx14 -print-ast %s | %FileCheck %s --check-prefixes=CHECK,CHECK-SWIFT5_9
1+
// RUN: %target-swift-frontend -print-ast %s | %FileCheck %s
2+
// RUN: %target-swift-frontend -application-extension -print-ast %s | %FileCheck %s
3+
// RUN: %target-swift-frontend -target %target-cpu-apple-macosx10.51 -print-ast %s | %FileCheck %s
4+
// RUN: %target-swift-frontend -target %target-cpu-apple-macosx14 -print-ast %s | %FileCheck %s
55
// REQUIRES: OS=macosx
66

77
// CHECK-LABEL: internal enum HasElementsWithAvailability : Hashable
@@ -35,11 +35,9 @@ enum HasElementsWithAvailability: Hashable {
3535
// CHECK-NEXT: case .alwaysAvailable:
3636
// CHECK-NEXT: index_a = 0
3737
// CHECK-NEXT: case .neverAvailable:
38-
// CHECK-PRE-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached_aeic()
39-
// CHECK-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached()
38+
// CHECK-NEXT: _diagnoseUnavailableCodeReached()
4039
// CHECK-NEXT: case .unavailableMacOS:
41-
// CHECK-PRE-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached_aeic()
42-
// CHECK-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached()
40+
// CHECK-NEXT: _diagnoseUnavailableCodeReached()
4341
// CHECK-NEXT: case .obsoleted10_50:
4442
// CHECK-NEXT: index_a = 1
4543
// CHECK-NEXT: case .introduced10_50:
@@ -52,11 +50,9 @@ enum HasElementsWithAvailability: Hashable {
5250
// CHECK-NEXT: case .alwaysAvailable:
5351
// CHECK-NEXT: index_b = 0
5452
// CHECK-NEXT: case .neverAvailable:
55-
// CHECK-PRE-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached_aeic()
56-
// CHECK-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached()
53+
// CHECK-NEXT: _diagnoseUnavailableCodeReached()
5754
// CHECK-NEXT: case .unavailableMacOS:
58-
// CHECK-PRE-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached_aeic()
59-
// CHECK-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached()
55+
// CHECK-NEXT: _diagnoseUnavailableCodeReached()
6056
// CHECK-NEXT: case .obsoleted10_50:
6157
// CHECK-NEXT: index_b = 1
6258
// CHECK-NEXT: case .introduced10_50:
@@ -73,11 +69,9 @@ enum HasElementsWithAvailability: Hashable {
7369
// CHECK-NEXT: case .alwaysAvailable:
7470
// CHECK-NEXT: discriminator = 0
7571
// CHECK-NEXT: case .neverAvailable:
76-
// CHECK-PRE-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached_aeic()
77-
// CHECK-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached()
72+
// CHECK-NEXT: _diagnoseUnavailableCodeReached()
7873
// CHECK-NEXT: case .unavailableMacOS:
79-
// CHECK-PRE-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached_aeic()
80-
// CHECK-SWIFT5_9-NEXT: _diagnoseUnavailableCodeReached()
74+
// CHECK-NEXT: _diagnoseUnavailableCodeReached()
8175
// CHECK-NEXT: case .obsoleted10_50:
8276
// CHECK-NEXT: discriminator = 1
8377
// CHECK-NEXT: case .introduced10_50:

0 commit comments

Comments
 (0)