diff options
| author | Thomas Bauereiss | 2020-05-07 20:07:00 +0100 |
|---|---|---|
| committer | Thomas Bauereiss | 2020-05-08 13:40:24 +0100 |
| commit | b8f99df745e03ca5805110f52f5263c2ee2813fe (patch) | |
| tree | fa106ec55ee3e1733afe1c12a5e5202c5b9ef5e2 /src | |
| parent | 87db18e7d1736f168491b49b7b339039260d7ac6 (diff) | |
Add another type annotation in bitvector cast rewrite
Diffstat (limited to 'src')
| -rw-r--r-- | src/monomorphise.ml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml index 149162d8..0e946f96 100644 --- a/src/monomorphise.ml +++ b/src/monomorphise.ml @@ -3336,8 +3336,10 @@ let rec rewrite_app env typ (id,args) = match get_constant_vec_len ~solve:true env typ, args with | Some i, [vector1; start1; end1] when is_bitvector_typ (typ_of vector1) && not (is_constant start1 && is_constant end1) -> - let low = if is_inc_vec (typ_of vector1) then start1 else end1 in - E_app (mk_id "slice", [vector1; low; mk_exp (E_lit (mk_lit (L_num i)))]) + let inc = is_inc_vec (typ_of vector1) in + let low = if inc then start1 else end1 in + let exp' = rewrap (E_app (mk_id "slice", [vector1; low; mk_exp (E_lit (mk_lit (L_num i)))])) in + E_cast (bitvector_typ (nconstant i) (if inc then inc_ord else dec_ord), exp') | _, _ -> E_app (id, args) (* Rewrite (v[x .. y] + i) to (v + (i << y))[x .. y], which is more amenable to further rewriting *) |
