From 3a01feb9ba0e676b8065b96c4cca82e65f18f0e4 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Tue, 19 Mar 2019 09:26:39 -0700 Subject: [PATCH] [sledge] Strengthen simplification of Convert exps Summary: Omit casts when source and destination types are equal. Reviewed By: mbouaziz Differential Revision: D14495814 fbshipit-source-id: 21bcfb6ab --- sledge/src/llair/exp.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/sledge/src/llair/exp.ml b/sledge/src/llair/exp.ml index da2b44f39..5078944d8 100644 --- a/sledge/src/llair/exp.ml +++ b/sledge/src/llair/exp.ml @@ -654,6 +654,7 @@ let float data = Float {data} |> check invariant let simp_convert signed (dst : Typ.t) src arg = match (dst, arg) with + | _ when Typ.equal dst src -> arg | Integer {bits= m}, Integer {data; typ= Integer {bits= n}} -> integer (Z.clamp ~signed (min m n) data) dst | _ -> App {op= Convert {signed; dst; src}; arg}