Skip to content

Commit

Permalink
Compiler: fix toplevel with globaldeacode
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Jan 21, 2024
1 parent 679bb51 commit 7df0b16
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions compiler/lib/global_deadcode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ let liveness prog pure_funs (global_info : Global_flow.info) =
| Stop | Branch _ | Poptrap _ | Pushtrap _ -> ()
in
Addr.Map.iter (fun _ block -> live_block block) prog.blocks;
Code.traverse
{ Code.fold = Code.fold_children }
(fun pc () ->
match Addr.Map.find pc prog.blocks with
| { branch = Return x, _; _ } -> add_top x
| _ -> ())
prog.start
prog.blocks
();
live_vars

(* Returns the set of variables given a table of variables. *)
Expand Down

0 comments on commit 7df0b16

Please sign in to comment.