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

Loading…
Cancel
Save