Skip to content

Commit

Permalink
Fix globalal flow analysis (see #1556)
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Sep 22, 2024
1 parent e2652fa commit c624ec2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 0 additions & 9 deletions compiler/lib/global_deadcode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,6 @@ 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
11 changes: 10 additions & 1 deletion compiler/lib/global_flow.ml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,16 @@ let expr_deps blocks st x e =
cont_deps blocks st cont
| Field (y, _, _) -> add_dep st x y

let program_deps st { blocks; _ } =
let program_deps st { start; blocks; _ } =
Code.traverse
{ Code.fold = Code.fold_children }
(fun pc () ->
match Addr.Map.find pc blocks with
| { branch = Return x, _; _ } -> do_escape st Escape x
| _ -> ())
start
blocks
();
Addr.Map.iter
(fun _ block ->
List.iter block.body ~f:(fun (i, _) ->
Expand Down

0 comments on commit c624ec2

Please sign in to comment.