Files
swift-mirror/test/IRGen/errors_optimized.sil
Nadav Rotem 3e8c871c6a Emit calls to swift_willThrow as part of SILGen using a builtin.
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
2015-04-28 18:36:22 +00:00

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
}