|
|
@ -544,8 +544,11 @@ module Prune = struct
|
|
|
|
let prune_has_next ~true_branch iterator ({mem} as astate) =
|
|
|
|
let prune_has_next ~true_branch iterator ({mem} as astate) =
|
|
|
|
let accum_prune_common ~prune_f loc acc =
|
|
|
|
let accum_prune_common ~prune_f loc acc =
|
|
|
|
let length = collection_length_of_iterator iterator mem in
|
|
|
|
let length = collection_length_of_iterator iterator mem in
|
|
|
|
let v = prune_f (Mem.find loc mem) length in
|
|
|
|
let v = Mem.find loc mem in
|
|
|
|
update_mem_in_prune loc v acc
|
|
|
|
if Val.is_bot length || Val.is_bot v then acc
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
let v' = prune_f v length in
|
|
|
|
|
|
|
|
update_mem_in_prune loc v' acc
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let accum_pruned loc tgt acc =
|
|
|
|
let accum_pruned loc tgt acc =
|
|
|
|
match tgt with
|
|
|
|
match tgt with
|
|
|
@ -575,15 +578,22 @@ module Prune = struct
|
|
|
|
match tgt with
|
|
|
|
match tgt with
|
|
|
|
| AliasTarget.Simple {i} when IntLit.iszero i ->
|
|
|
|
| AliasTarget.Simple {i} when IntLit.iszero i ->
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
|
|
|
else
|
|
|
|
let v' = Val.prune_ne_zero v in
|
|
|
|
let v' = Val.prune_ne_zero v in
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
| AliasTarget.Empty ->
|
|
|
|
| AliasTarget.Empty ->
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
|
|
|
else
|
|
|
|
let v' = Val.prune_length_eq_zero v in
|
|
|
|
let v' = Val.prune_length_eq_zero v in
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
| AliasTarget.Fgets ->
|
|
|
|
| AliasTarget.Fgets ->
|
|
|
|
let strlen_loc = Loc.of_c_strlen rhs in
|
|
|
|
let strlen_loc = Loc.of_c_strlen rhs in
|
|
|
|
let v' = Val.prune_ge_one (Mem.find strlen_loc mem) in
|
|
|
|
let v = Mem.find strlen_loc mem in
|
|
|
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
let v' = Val.prune_ge_one v in
|
|
|
|
update_mem_in_prune strlen_loc v' acc
|
|
|
|
update_mem_in_prune strlen_loc v' acc
|
|
|
|
| AliasTarget.IteratorHasNext _ ->
|
|
|
|
| AliasTarget.IteratorHasNext _ ->
|
|
|
|
prune_has_next ~true_branch:true rhs acc
|
|
|
|
prune_has_next ~true_branch:true rhs acc
|
|
|
@ -596,10 +606,14 @@ module Prune = struct
|
|
|
|
match tgt with
|
|
|
|
match tgt with
|
|
|
|
| AliasTarget.Simple {i} when IntLit.iszero i ->
|
|
|
|
| AliasTarget.Simple {i} when IntLit.iszero i ->
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
|
|
|
else
|
|
|
|
let v' = Val.prune_eq_zero v in
|
|
|
|
let v' = Val.prune_eq_zero v in
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
| AliasTarget.Empty ->
|
|
|
|
| AliasTarget.Empty ->
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
|
|
|
else
|
|
|
|
let v' = Val.prune_length_ge_one v in
|
|
|
|
let v' = Val.prune_length_ge_one v in
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
| AliasTarget.IteratorHasNext _ ->
|
|
|
|
| AliasTarget.IteratorHasNext _ ->
|
|
|
@ -655,7 +669,7 @@ module Prune = struct
|
|
|
|
let v' = eval integer_type_widths e mem in
|
|
|
|
let v' = eval integer_type_widths e mem in
|
|
|
|
if IntLit.iszero i then v' else Val.minus_a v' (Val.of_int_lit i)
|
|
|
|
if IntLit.iszero i then v' else Val.minus_a v' (Val.of_int_lit i)
|
|
|
|
in
|
|
|
|
in
|
|
|
|
if Val.is_bot rhs then acc
|
|
|
|
if Val.is_bot lhs || Val.is_bot rhs then acc
|
|
|
|
else
|
|
|
|
else
|
|
|
|
let v = val_prune_eq lhs rhs in
|
|
|
|
let v = val_prune_eq lhs rhs in
|
|
|
|
let pruning_exp = make_pruning_exp ~lhs ~rhs in
|
|
|
|
let pruning_exp = make_pruning_exp ~lhs ~rhs in
|
|
|
@ -676,6 +690,8 @@ module Prune = struct
|
|
|
|
|> Val.of_itv |> Val.set_itv_updated_by_addition
|
|
|
|
|> Val.of_itv |> Val.set_itv_updated_by_addition
|
|
|
|
in
|
|
|
|
in
|
|
|
|
let rhs = eval integer_type_widths e mem in
|
|
|
|
let rhs = eval integer_type_widths e mem in
|
|
|
|
|
|
|
|
if Val.is_bot lhs || Val.is_bot rhs then astate
|
|
|
|
|
|
|
|
else
|
|
|
|
let prune_target val_prune astate =
|
|
|
|
let prune_target val_prune astate =
|
|
|
|
let lhs' = val_prune lhs rhs in
|
|
|
|
let lhs' = val_prune lhs rhs in
|
|
|
|
let array_v' =
|
|
|
|
let array_v' =
|
|
|
|