Skip to content

Commit 6710e59

Browse files
authored
Better type for switch table symbols (#2174)
1 parent 00aa492 commit 6710e59

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

middle_end/flambda2/simplify/simplify_switch_expr.ml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,21 @@ let rebuild_switch_with_single_arg_to_same_destination uacc ~dacc_before_switch
287287
in
288288
let uacc =
289289
let fields = List.map Field_of_static_block.tagged_immediate consts in
290+
let block_type =
291+
T.immutable_block ~is_unique:false Tag.zero ~field_kind:K.value
292+
Alloc_mode.For_types.heap
293+
~fields:
294+
(List.map
295+
(fun const ->
296+
T.alias_type_of K.value
297+
(Simple.const (Reg_width_const.const_int const)))
298+
consts)
299+
in
290300
UA.add_lifted_constant uacc
291301
(LC.create_definition
292302
(LC.Definition.block_like
293303
(DA.denv dacc_before_switch)
294-
block_sym T.any_block ~symbol_projections:Variable.Map.empty
304+
block_sym block_type ~symbol_projections:Variable.Map.empty
295305
(RSC.create_block rebuilding tag Immutable ~fields)))
296306
in
297307
(* CR mshinwell: consider sharing the constants *)

0 commit comments

Comments
 (0)