Files
swift-mirror/test/IRGen/unconditional_checked_cast.sil
Anthony Latsis b5aec4cc34 [test] Remove pre-rebranch nocapture matches
These were added in https://github.com/swiftlang/swift/pull/81375 (and
several other follow-up PRs because we missed a few places) and
are no longer needed.
2025-10-24 02:07:22 +01:00

30 lines
1.2 KiB
Plaintext

// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
// REQUIRES: CPU=x86_64
// Make sure that we are able to lower unconditional_checked_cast
// addresses for the super_to_archetype case and the downcast case.
class C {}
sil_vtable C {}
class D : C {}
sil_vtable D {}
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @downcast_test(ptr noalias sret({{.*}}) captures(none) %0, ptr captures(none) dereferenceable({{.*}}) %1) {{.*}} {
// CHECK: entry:
// CHECK-NEXT: [[INPUTPTR:%[0-9]+]] = load ptr, ptr [[INPUTPTRPTR:%[0-9]+]], align 8
// CHECK-NEXT: [[TMP:%.*]] = call swiftcc %swift.metadata_response @"$s26unconditional_checked_cast1DCMa"(i64 0)
// CHECK-NEXT: [[T0:%.*]] = extractvalue %swift.metadata_response [[TMP]], 0
// CHECK-NEXT: [[I8RESULTPTR:%.*]] = call ptr @swift_dynamicCastClassUnconditional(ptr [[INPUTPTR]], ptr [[T0]], {{.*}})
// CHECK-NEXT: store ptr [[I8RESULTPTR]], ptr {{%[0-9]+}}, align 8
// CHECK-NEXT: ret void
sil @downcast_test : $@convention(thin) (@inout C) -> @out D {
bb0(%0 : $*D, %1 : $*C):
%a = load %1 : $*C
%2 = unconditional_checked_cast %a : $C to D
store %2 to %0 : $*D
%33 = tuple()
return %33 : $()
}