Skip to content

Commit ff7542a

Browse files
committed
Add SIL combine test for Builtin.isConcrete
1 parent a1f3cb9 commit ff7542a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/SILOptimizer/sil_combine.sil

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ protocol FakeProtocol {
3636
func requirement()
3737
}
3838

39+
struct MyInt {
40+
var value: Builtin.Int32
41+
}
42+
3943
sil [global_init] @global_init_fun : $@convention(thin) () -> Builtin.RawPointer
4044

4145
sil @user : $@convention(thin) (@owned Builtin.NativeObject) -> ()
@@ -3723,3 +3727,26 @@ bb0(%2 : $TestObjCInit):
37233727
%19 = enum $Optional<TestObjCInit>, #Optional.some!enumelt.1, %14 : $TestObjCInit
37243728
return %19 : $Optional<TestObjCInit>
37253729
}
3730+
3731+
// CHECK-LABEL: sil @isConcrete_true : $@convention(thin) (@thin MyInt.Type) -> Builtin.Int1 {
3732+
// CHECK: bb0(%0 : $@thin MyInt.Type):
3733+
// CHECK: [[RESULT:%.*]] = integer_literal $Builtin.Int1, -1
3734+
// CHECK: return [[RESULT]]
3735+
// CHECK: } // end sil function 'isConcrete_true'
3736+
sil @isConcrete_true : $@convention(thin) (@thin MyInt.Type) -> Builtin.Int1 {
3737+
bb0(%0 : $@thin MyInt.Type):
3738+
%1 = builtin "isConcrete"(%0 : $@thin MyInt.Type) : $Builtin.Int1
3739+
return %1 : $Builtin.Int1
3740+
}
3741+
3742+
// CHECK-LABEL: sil @isConcrete_false : $@convention(thin) <T> (@thin T.Type) -> Builtin.Int1 {
3743+
// CHECK: bb0(%0 : $@thin T.Type):
3744+
// CHECK: [[RESULT:%.*]] = builtin "isConcrete"<T>(%0 : $@thin T.Type) : $Builtin.Int1
3745+
// CHECK: return [[RESULT]]
3746+
// CHECK: } // end sil function 'isConcrete_false'
3747+
sil @isConcrete_false : $@convention(thin) <T> (@thin T.Type) -> Builtin.Int1 {
3748+
bb0(%0 : $@thin T.Type):
3749+
// FIXME: Explicit specialization is required here when it shouldn't be
3750+
%1 = builtin "isConcrete"<T>(%0 : $@thin T.Type) : $Builtin.Int1
3751+
return %1 : $Builtin.Int1
3752+
}

0 commit comments

Comments
 (0)