summaryrefslogtreecommitdiff
path: root/src/ast_util.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast_util.ml')
-rw-r--r--src/ast_util.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ast_util.ml b/src/ast_util.ml
index 3f13e6ad..546faf14 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