From bab7c8bff9fd6dd42e4fa9908303d2d8ad3c33fc Mon Sep 17 00:00:00 2001 From: Brian Campbell Date: Fri, 3 Nov 2017 15:33:20 +0000 Subject: Make nexp_simp a little smarter --- src/ast_util.ml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/ast_util.ml b/src/ast_util.ml index 707ec93c..7d366803 100644 --- a/src/ast_util.ml +++ b/src/ast_util.ml @@ -198,6 +198,9 @@ and nexp_simp_aux = function let (Nexp_aux (n2_simp, _) as n2) = nexp_simp n2 in match n1_simp, n2_simp with | Nexp_constant c1, Nexp_constant c2 -> Nexp_constant (c1 - c2) + (* A vector range x['n-1 .. 0] can result in the size "('n-1) - -1" *) + | Nexp_minus (Nexp_aux (n,_), Nexp_aux (Nexp_constant c1,_)), Nexp_constant c2 + when c1 = -c2 -> n | _, _ -> Nexp_minus (n1, n2) end | nexp -> nexp -- cgit v1.2.3