From f5723aebea8a0e22def3072710384f2410f65e46 Mon Sep 17 00:00:00 2001 From: Brian Campbell Date: Fri, 2 Feb 2018 16:31:25 +0000 Subject: Extra nexp simplification --- src/ast_util.ml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/ast_util.ml b/src/ast_util.ml index 891990b4..6b605886 100644 --- a/src/ast_util.ml +++ b/src/ast_util.ml @@ -193,6 +193,10 @@ let rec is_nexp_constant (Nexp_aux (nexp, _)) = match nexp with let rec nexp_simp (Nexp_aux (nexp, l)) = Nexp_aux (nexp_simp_aux nexp, l) and nexp_simp_aux = function + (* (n - (n - m)) often appears in foreach loops *) + | Nexp_minus (nexp1, Nexp_aux (Nexp_minus (nexp2, Nexp_aux (n3,_)),_)) + when nexp_identical nexp1 nexp2 -> + nexp_simp_aux n3 | Nexp_minus (Nexp_aux (Nexp_sum (Nexp_aux (n1, _), nexp2), _), nexp3) when nexp_identical nexp2 nexp3 -> nexp_simp_aux n1 -- cgit v1.2.3