mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Calls to willThrow are marked as read-none so that the optimizer can remove them. The willThrow builtin is still generated for all throw/rethrow sites, but I plan to look at this next. rdar://20356658 Swift SVN r27877
21 lines
541 B
Plaintext
21 lines
541 B
Plaintext
// RUN: %target-swift-frontend %s -O -emit-ir | FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
enum ColorError : _ErrorType {
|
|
case Red, Green, Blue
|
|
}
|
|
|
|
// CHECK-LABEL: TestCallToWillThrowCallBack
|
|
// CHECK-NOT: call void @swift_willThrow(%swift.error* %0)
|
|
// CHECK: ret i64 undef
|
|
sil hidden @TestCallToWillThrowCallBack : $@convention(thin) (@owned _ErrorType) -> (Int64, @error _ErrorType) {
|
|
bb0(%0 : $_ErrorType):
|
|
builtin "willThrow"(%0 : $_ErrorType) : $()
|
|
throw %0 : $_ErrorType // id: %3
|
|
}
|
|
|