From 7df0b1612bf1a51c8f0b607a85ddb387a6732186 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Sun, 21 Jan 2024 08:26:48 +0100 Subject: [PATCH] Compiler: fix toplevel with globaldeacode --- compiler/lib/global_deadcode.ml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/lib/global_deadcode.ml b/compiler/lib/global_deadcode.ml index bc8017d5d9..9af29d950e 100644 --- a/compiler/lib/global_deadcode.ml +++ b/compiler/lib/global_deadcode.ml @@ -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. *)