summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Campbell2019-01-29 16:54:36 +0000
committerBrian Campbell2019-01-31 10:30:48 +0000
commit20334e0f8d1115bf7f70226f5020df180d5d7f89 (patch)
treec3247575957aab8cb5a0b499c126ac0b4e11f106 /src
parent60164a9a221ed6566f1067100dbea2ec828b47d2 (diff)
Support case splitting on variables as well as sizeof in cast introduction
Diffstat (limited to 'src')
-rw-r--r--src/monomorphise.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml
index 76a48cd7..666abe86 100644
--- a/src/monomorphise.ml
+++ b/src/monomorphise.ml
@@ -4107,6 +4107,13 @@ let add_bitvector_casts (Defs defs) =
(match destruct_atom_nexp (env_of y) (typ_of y) with
| Some (Nexp_aux (Nexp_constant i,_)) -> [(kid,i)]
| _ -> [])
+ | E_app (op,[x;y])
+ when string_of_id op = "eq_int" ->
+ (match destruct_atom_nexp (env_of x) (typ_of x), destruct_atom_nexp (env_of y) (typ_of y) with
+ | Some (Nexp_aux (Nexp_var kid,_)), Some (Nexp_aux (Nexp_constant i,_))
+ | Some (Nexp_aux (Nexp_constant i,_)), Some (Nexp_aux (Nexp_var kid,_))
+ -> [(kid,i)]
+ | _ -> [])
| E_app (op, [x;y]) when string_of_id op = "and_bool" ->
extract x @ extract y
| _ -> []