blob: 1754b66f098db7a4f6fea97e53b9e47ae23a377d [file] [log] [blame]
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -inline %s | %FileCheck %s
// Check if cloning of select_value and switch_value works correctly without
// producing illegal SIL.
sil_stage canonical
import Builtin
sil [always_inline] @callee : $@convention(thin) () -> () {
bb0:
%1 = integer_literal $Builtin.Word, 1
%2 = integer_literal $Builtin.Word, 2
%3 = integer_literal $Builtin.Word, 3
%4 = select_value %1: $Builtin.Word, case %1: %2, case %2: %1, default %3 : $Builtin.Word
switch_value %1 : $Builtin.Word, case %1: bb1, case %2: bb2
bb1:
br bb3
bb2:
br bb3
bb3:
%5 = tuple ()
return %5 : $()
}
// CHECK-LABEL: sil @caller : $@convention(thin) () -> ()
// CHECK: select_value
// CHECK: switch_value
sil @caller : $@convention(thin) () -> () {
bb0:
%0 = function_ref @callee : $@convention(thin) () -> ()
%1 = apply %0() : $@convention(thin) () -> ()
%2 = tuple ()
return %2 : $()
}