You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sil @convert_select_enum_cond_br_to_switch_enum2 : $@convention(thin) (Numerals) -> Builtin.Int64 {
196
+
bb0(%0 : $Numerals):
197
+
%2 = integer_literal $Builtin.Int1, 0
198
+
%3 = integer_literal $Builtin.Int1, -1
199
+
// All cases but one are the same. So, they can be made a default for the switch_enum.
200
+
%4 = select_enum %0 : $Numerals, case #Numerals.One!enumelt: %3, case #Numerals.Two!enumelt: %2, case #Numerals.Three!enumelt: %3, case #Numerals.Four!enumelt: %3 : $Builtin.Int1
// Check that cond_br(select_enum) is not converted into switch_enum as it would create a critical edge, which
182
251
// is not originating from cond_br/br. And this is forbidden in a canonical SIL form.
@@ -206,6 +275,64 @@ bb2:
206
275
br bb1
207
276
}
208
277
278
+
// Check that cond_br(select_enum) is not converted into switch_enum as it would create a critical edge, which
279
+
// is not originating from cond_br/br. And this is forbidden in a canonical SIL form.
280
+
//
281
+
// CHECK-LABEL: sil @dont_convert_select_enum_cond_br_to_switch_enum2
282
+
// CHECK: select_enum
283
+
// CHECK-NOT: switch_enum
284
+
// CHECK: return
285
+
sil @dont_convert_select_enum_cond_br_to_switch_enum2 : $@convention(thin) (Numerals) -> Builtin.Int64 {
286
+
bb0(%0 : $Numerals):
287
+
%2 = integer_literal $Builtin.Int1, 0
288
+
%3 = integer_literal $Builtin.Int1, -1
289
+
// There are two cases for each possible outcome.
290
+
// This means that we would always get a critical edge, if we convert it into a switch_enum.
291
+
%4 = select_enum %0 : $Numerals, case #Numerals.One!enumelt: %3, case #Numerals.Two!enumelt: %2, case #Numerals.Three!enumelt: %3, case #Numerals.Four!enumelt: %2 : $Builtin.Int1
0 commit comments