aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-09-21 08:28:19 -0700
committerGraydon Hoare <[email protected]>2010-09-21 08:28:19 -0700
commit28b9357a0cb427b3d2bae439d393ca6bf73ad8d5 (patch)
tree0438265c232f5c60103b44a04562298f1c289718 /src/boot
parentSkip 0-ary tag ctors in Trans.iter_tag_parts. Rustc loses 150kb. (diff)
downloadrust-28b9357a0cb427b3d2bae439d393ca6bf73ad8d5.tar.xz
rust-28b9357a0cb427b3d2bae439d393ca6bf73ad8d5.zip
Kill residual dead code in Trans.iter_tag_parts. Shaves a couple kb off rustc.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/me/trans.ml12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml
index e70c3196..064f027f 100644
--- a/src/boot/me/trans.ml
+++ b/src/boot/me/trans.ml
@@ -2719,6 +2719,7 @@ let trans_visitor
if Array.length ttup <> 0
then
begin
+ let pc0 = (emitter()).Il.emit_pc in
(iflog (fun _ ->
annotate (Printf.sprintf "tag case #%i" i)));
let jmps =
@@ -2726,12 +2727,21 @@ let trans_visitor
(Il.Cell tmp) (imm (Int64.of_int i))
in
let ttup = get_nth_tag_tup cx ttag i in
+ let pc1 = (emitter()).Il.emit_pc in
iter_tup_parts
(get_element_ptr_dyn ty_params)
(get_variant_ptr dst_union i)
(get_variant_ptr src_union i)
ttup f;
- List.iter patch jmps
+
+ (* Hack: if this variant is all dead code, blank it out. *)
+ if pc1 = (emitter()).Il.emit_pc
+ then
+ begin
+ for j = pc0 to (pc1-1)
+ do (emitter()).Il.emit_quads.(j) <- Il.deadq done
+ end;
+ List.iter patch jmps;
end
done;