Skip to content

Commit 85edef4

Browse files
committed
Only add deadcode_sentinel if absent
1 parent 1d82a9f commit 85edef4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/lib/global_deadcode.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,11 @@ let f p ~deadcode_sentinal global_info =
558558
Code.invariant p;
559559
let t = Timer.make () in
560560
(* Add sentinal variable *)
561-
let p = add_sentinal p deadcode_sentinal in
561+
let p =
562+
match global_info.Global_flow.info_defs.(Var.idx deadcode_sentinal) with
563+
| Expr _ -> p
564+
| _ -> add_sentinal p deadcode_sentinal
565+
in
562566
(* Compute definitions *)
563567
let defs = definitions p in
564568
(* Compute initial liveness *)
@@ -583,4 +587,5 @@ let f p ~deadcode_sentinal global_info =
583587
Format.eprintf "After Zeroing:@.";
584588
Code.Print.program Format.err_formatter (fun _ _ -> "") p);
585589
if times () then Format.eprintf " global dead code elim.: %a@." Timer.print t;
590+
Code.invariant p;
586591
p

0 commit comments

Comments
 (0)