Skip to content

Commit 71d49a2

Browse files
committed
Skip 0-ary tag ctors in Trans.iter_tag_parts. Rustc loses 150kb.
1 parent c5f4789 commit 71d49a2

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/boot/me/trans.ml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,18 +2715,24 @@ let trans_visitor
27152715
mov tmp (Il.Cell src_tag);
27162716
for i = 0 to n-1
27172717
do
2718-
(iflog (fun _ ->
2719-
annotate (Printf.sprintf "tag case #%i" i)));
2720-
let jmps =
2721-
trans_compare_simple Il.JNE (Il.Cell tmp) (imm (Int64.of_int i))
2722-
in
27232718
let ttup = get_nth_tag_tup cx ttag i in
2724-
iter_tup_parts
2725-
(get_element_ptr_dyn ty_params)
2726-
(get_variant_ptr dst_union i)
2727-
(get_variant_ptr src_union i)
2728-
ttup f;
2729-
List.iter patch jmps
2719+
if Array.length ttup <> 0
2720+
then
2721+
begin
2722+
(iflog (fun _ ->
2723+
annotate (Printf.sprintf "tag case #%i" i)));
2724+
let jmps =
2725+
trans_compare_simple Il.JNE
2726+
(Il.Cell tmp) (imm (Int64.of_int i))
2727+
in
2728+
let ttup = get_nth_tag_tup cx ttag i in
2729+
iter_tup_parts
2730+
(get_element_ptr_dyn ty_params)
2731+
(get_variant_ptr dst_union i)
2732+
(get_variant_ptr src_union i)
2733+
ttup f;
2734+
List.iter patch jmps
2735+
end
27302736
done;
27312737

27322738
and seq_unit_ty (seq:Ast.ty) : Ast.ty =

0 commit comments

Comments
 (0)