mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fixes a SIL verifier crash. https://github.com/swiftlang/swift/issues/82093 rdar://152807200
40 lines
1.6 KiB
Plaintext
40 lines
1.6 KiB
Plaintext
// RUN: %target-sil-opt -sil-print-types -enable-sil-opaque-values -enable-sil-verify-all -generic-specializer %s | %FileCheck %s
|
|
|
|
sil_stage raw
|
|
|
|
import Builtin
|
|
|
|
// Test that foo is specialized on Builtin.Int64 and the copy_values and destroy_values are dropped.
|
|
//
|
|
// CHECK-LABEL: sil shared [ossa] @$s3fooBi64__Tg5 : $@convention(thin) (Builtin.Int64, Builtin.Int64) -> () {
|
|
// CHECK: bb0(%0 : $Builtin.Int64, %1 : $Builtin.Int64):
|
|
// CHECK: [[F:%.*]] = function_ref @$s3fooBi64__Tg5 : $@convention(thin) (Builtin.Int64, Builtin.Int64) -> ()
|
|
// CHECK: %{{.*}} = apply [[F]](%0, %1) : $@convention(thin) (Builtin.Int64, Builtin.Int64) -> ()
|
|
// CHECK-NOT: copy_value
|
|
// CHECK-NOT: destroy_value
|
|
// CHECK-NOT: extend_lifetime
|
|
// CHECK-NOT: end_lifetime
|
|
// CHECK: return %{{.*}} : $()
|
|
// CHECK-LABEL: } // end sil function '$s3fooBi64__Tg5'
|
|
sil hidden [ossa] @foo : $@convention(thin) <T> (@in T, @in T) -> () {
|
|
bb0(%0 : @owned $T, %1 : @owned $T):
|
|
%f = function_ref @foo : $@convention(thin) <τ_0_0> (@in τ_0_0, @in τ_0_0) -> ()
|
|
%cp0 = copy_value %0 : $T
|
|
%cp1 = copy_value %1 : $T
|
|
%cp3 = explicit_copy_value %1 : $T
|
|
%call = apply %f<T>(%cp0, %cp1) : $@convention(thin) <τ_0_0> (@in τ_0_0, @in τ_0_0) -> ()
|
|
destroy_value %1 : $T
|
|
end_lifetime %0 : $T
|
|
extend_lifetime %cp3 : $T
|
|
%10 = tuple ()
|
|
return %10 : $()
|
|
}
|
|
|
|
sil @testSpecialize : $@convention(thin) (Builtin.Int64) -> () {
|
|
bb0(%0: $Builtin.Int64):
|
|
%f = function_ref @foo : $@convention(thin) <T> (@in T, @in T) -> ()
|
|
%call = apply %f<Builtin.Int64>(%0, %0) : $@convention(thin) <τ_0_0> (@in τ_0_0, @in τ_0_0) -> ()
|
|
%999 = tuple ()
|
|
return %999 : $()
|
|
}
|