Skip to content

Commit fcb0dcc

Browse files
committed
Update and ammend test case
1 parent 95e31ee commit fcb0dcc

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

test/IRGen/enum_value_semantics_special_cases_objc.sil

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ enum AllMixedRefcounted {
3535
// CHECK: %0 = bitcast %swift.opaque* %object to %T39enum_value_semantics_special_cases_objc18AllMixedRefcountedO*
3636
// CHECK: %1 = bitcast %T39enum_value_semantics_special_cases_objc18AllMixedRefcountedO* %0 to i64*
3737
// CHECK: %2 = load i64, i64* %1, align 8
38-
// -- 0x3fffffffffffffff
39-
// CHECK: %3 = and i64 %2, 4611686018427387903
40-
// CHECK: %4 = inttoptr i64 %3 to %objc_object*
41-
// CHECK: call void @swift_unknownRelease(%objc_object* %4) {{#[0-9]+}}
38+
// CHECK: %3 = lshr i64 %2, 62
39+
// CHECK: %4 = trunc i64 %3 to i8
40+
// CHECK: %5 = and i8 %4, 3
41+
// CHECK: call void @"$S39enum_value_semantics_special_cases_objc18AllMixedRefcountedOWOe"(i64 %2)
4242
// CHECK: ret void
4343
// CHECK: }
4444

@@ -52,3 +52,51 @@ enum AllMixedRefcountedTwoSimple {
5252

5353
// CHECK-LABEL: define linkonce_odr hidden void @"$S39enum_value_semantics_special_cases_objc27AllMixedRefcountedTwoSimpleOwxx"
5454
// CHECK: call void @"$S39enum_value_semantics_special_cases_objc27AllMixedRefcountedTwoSimpleOWOy"
55+
56+
struct Val {
57+
}
58+
59+
// Currently, swift_unknownRelease does not support the indirect heap object.
60+
61+
enum MixedRefcountedWithIndirect {
62+
indirect case Indirect(Builtin.Int64)
63+
case Ref(Builtin.UnknownObject)
64+
case None
65+
}
66+
67+
// CHECK-LABEL: define linkonce_odr hidden void @"$S39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectOwxx"(%swift.opaque* noalias %object, %swift.type* %MixedRefcountedWithIndirect)
68+
// CHECK: entry:
69+
// CHECK: %0 = bitcast %swift.opaque* %object to %T39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectO*
70+
// CHECK: %1 = bitcast %T39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectO* %0 to i64*
71+
// CHECK: %2 = load i64, i64* %1, align 8
72+
// CHECK: %3 = lshr i64 %2, 62
73+
// CHECK: %4 = trunc i64 %3 to i8
74+
// CHECK: %5 = and i8 %4, 3
75+
// CHECK: call void @"$S39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectOWOe"(i64 %2)
76+
// CHECK: ret void
77+
// CHECK: }
78+
79+
80+
// CHECK-LABEL: define linkonce_odr hidden void @"$S39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectOWOe"(i64)
81+
// CHECK: entry:
82+
// CHECK: %1 = lshr i64 %0, 62
83+
// CHECK: %2 = trunc i64 %1 to i8
84+
// CHECK: %3 = and i8 %2, 3
85+
// CHECK: switch i8 %3, label %9 [
86+
// CHECK: i8 0, label %4
87+
// CHECK: i8 1, label %6
88+
// CHECK: ]
89+
90+
// CHECK: ; <label>:4:
91+
// CHECK: %5 = inttoptr i64 %0 to %swift.refcounted*
92+
// CHECK: call void @swift_release(%swift.refcounted* %5) #1
93+
// CHECK: br label %9
94+
95+
// CHECK: ; <label>:6:
96+
// CHECK: %7 = and i64 %0, 4611686018427387903
97+
// CHECK: %8 = inttoptr i64 %7 to %objc_object*
98+
// CHECK: call void @swift_unknownRelease(%objc_object* %8) #1
99+
// CHECK: br label %9
100+
101+
// CHECK: ; <label>:9:
102+
// CHECK: ret void

0 commit comments

Comments
 (0)