Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions compiler/lib/structure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@ let is_forward g pc pc' = Hashtbl.find g.block_order pc < Hashtbl.find g.block_o
let is_merge_node' block_order preds pc =
let s = try Hashtbl.find preds pc with Not_found -> Addr.Set.empty in
let o = Hashtbl.find block_order pc in
let n =
Addr.Set.fold (fun pc' n -> if Hashtbl.find block_order pc' < o then n + 1 else n) s 0
in
n > 1
try
ignore
(Addr.Set.fold
(fun pc' found_first ->
if Hashtbl.find block_order pc' < o
then
if found_first
then (* Exit early to avoid quadratic behavior *) raise Exit
else true
else found_first)
s
false);
false
with Exit -> true

let empty_body body =
List.for_all
Expand Down
Loading