[sledge] Strengthen simplification of convert Exps

Summary:
Simplify all conversions between castable types to the identity. The
backend treats castable types as equal, so distinguishing conversions
between them is incomplete.

Reviewed By: kren1

Differential Revision: D15972427

fbshipit-source-id: fa09859ac
master
Josh Berdine 6 years ago committed by Facebook Github Bot
parent cc1f88a747
commit a58bc25aa5

@ -690,7 +690,7 @@ let minus_one (typ : Typ.t) =
let simp_convert signed (dst : Typ.t) src arg = let simp_convert signed (dst : Typ.t) src arg =
match (dst, arg) with match (dst, arg) with
| _ when Typ.equal dst src -> arg | _ when Typ.castable dst src -> arg
| Integer {bits= m}, Integer {data; typ= Integer {bits= n}} -> | Integer {bits= m}, Integer {data; typ= Integer {bits= n}} ->
integer (Z.clamp ~signed (min m n) data) dst integer (Z.clamp ~signed (min m n) data) dst
| _ -> App {op= Convert {signed; dst; src}; arg} | _ -> App {op= Convert {signed; dst; src}; arg}

Loading…
Cancel
Save