AbstractInterpreter: less garbage

Summary:
Replace `map |> filter_opt |> fold` with one `fold`.
Also preparing for future changes...

Reviewed By: ngorogiannis

Differential Revision: D8185643

fbshipit-source-id: 4d311eb
master
Mehdi Bouaziz 7 years ago committed by Facebook Github Bot
parent 0f8111d0d0
commit 342af52dce

@ -104,12 +104,17 @@ struct
let rec exec_worklist cfg work_queue inv_map proc_data ~debug =
let compute_pre node inv_map =
let extract_post_ pred = extract_post (CFG.id pred) inv_map in
let all_posts = List.map ~f:extract_post_ (CFG.preds cfg node) in
match List.filter_opt all_posts with
| post :: posts ->
Some (List.fold ~f:Domain.join ~init:post posts)
| [] ->
None
CFG.preds cfg node
|> List.fold ~init:None ~f:(fun joined_post_opt pred ->
match extract_post_ pred with
| None ->
joined_post_opt
| Some post as some_post ->
match joined_post_opt with
| None ->
some_post
| Some joined_post ->
Some (Domain.join joined_post post) )
in
match Scheduler.pop work_queue with
| Some (_, [], work_queue') ->

Loading…
Cancel
Save