// RUN: %target-sil-opt -enable-sil-verify-all -O %s | %FileCheck %s sil_stage raw import Swift public class SelfCasts { } // CHECK-LABEL: sil @$dynamic_self_cast_1 : $@convention(method) (@guaranteed SelfCasts, @thick SelfCasts.Type) -> @owned Optional sil @$dynamic_self_cast_1 : $@convention(method) (@guaranteed SelfCasts, @thick SelfCasts.Type) -> @owned Optional { bb0(%0 : $SelfCasts, %1 : $@thick SelfCasts.Type): strong_retain %0 : $SelfCasts // CHECK: checked_cast_br checked_cast_br SelfCasts in %0 : $SelfCasts to @dynamic_self SelfCasts, bb1, bb2 bb1(%7 : $SelfCasts): %8 = enum $Optional, #Optional.some!enumelt, %7 : $SelfCasts br bb3(%8 : $Optional) bb2: strong_release %0 : $SelfCasts %11 = enum $Optional, #Optional.none!enumelt br bb3(%11 : $Optional) bb3(%13 : $Optional): return %13 : $Optional } // CHECK-LABEL: sil {{.*}}@$dynamic_self_cast_2 : $@convention(method) (@guaranteed SelfCasts, @thick SelfCasts.Type) -> @owned Optional sil @$dynamic_self_cast_2 : $@convention(method) (@guaranteed SelfCasts, @thick SelfCasts.Type) -> @owned Optional { bb0(%0 : $SelfCasts, %1 : $@thick SelfCasts.Type): strong_retain %0 : $SelfCasts // CHECK-NOT: checked_cast_br checked_cast_br SelfCasts in %0 : $SelfCasts to SelfCasts, bb1, bb2 bb1(%7 : $SelfCasts): %8 = enum $Optional, #Optional.some!enumelt, %7 : $SelfCasts br bb3(%8 : $Optional) bb2: strong_release %0 : $SelfCasts %11 = enum $Optional, #Optional.none!enumelt br bb3(%11 : $Optional) bb3(%13 : $Optional): return %13 : $Optional }