Add 1+ 1- integer range propagation support

* lisp/emacs-lisp/comp-cstr.el (comp-cstr-one): New special var.
	* lisp/emacs-lisp/comp.el (comp-fwprop-call): Propagate integer
	ranges on +1 -1.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add two tests.
This commit is contained in:
Andrea Corallo 2020-12-27 21:33:07 +01:00
parent 7d07a71841
commit 42fb6de0b3
3 changed files with 20 additions and 2 deletions

View file

@ -2651,7 +2651,9 @@ Fold the call in case."
(comp-mvar-neg lval) (comp-cstr-neg cstr))))
(cl-case f
(+ (comp-cstr-add lval args))
(- (comp-cstr-sub lval args)))))
(- (comp-cstr-sub lval args))
(1+ (comp-cstr-add lval `(,(car args) ,comp-cstr-one)))
(1- (comp-cstr-sub lval `(,(car args) ,comp-cstr-one))))))
(defun comp-fwprop-insn (insn)
"Propagate within INSN."