Skip to content

Commit 396c82b

Browse files
committed
---
yaml --- r: 695 b: refs/heads/master c: 28b9357 h: refs/heads/master i: 693: 528af30 691: 288c528 687: c256bc7 v: v3
1 parent efa471f commit 396c82b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 71d49a20a7f76602501e274cc089758b58d225ce
2+
refs/heads/master: 28b9357a0cb427b3d2bae439d393ca6bf73ad8d5

trunk/src/boot/me/trans.ml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2719,19 +2719,29 @@ let trans_visitor
27192719
if Array.length ttup <> 0
27202720
then
27212721
begin
2722+
let pc0 = (emitter()).Il.emit_pc in
27222723
(iflog (fun _ ->
27232724
annotate (Printf.sprintf "tag case #%i" i)));
27242725
let jmps =
27252726
trans_compare_simple Il.JNE
27262727
(Il.Cell tmp) (imm (Int64.of_int i))
27272728
in
27282729
let ttup = get_nth_tag_tup cx ttag i in
2730+
let pc1 = (emitter()).Il.emit_pc in
27292731
iter_tup_parts
27302732
(get_element_ptr_dyn ty_params)
27312733
(get_variant_ptr dst_union i)
27322734
(get_variant_ptr src_union i)
27332735
ttup f;
2734-
List.iter patch jmps
2736+
2737+
(* Hack: if this variant is all dead code, blank it out. *)
2738+
if pc1 = (emitter()).Il.emit_pc
2739+
then
2740+
begin
2741+
for j = pc0 to (pc1-1)
2742+
do (emitter()).Il.emit_quads.(j) <- Il.deadq done
2743+
end;
2744+
List.iter patch jmps;
27352745
end
27362746
done;
27372747

0 commit comments

Comments
 (0)