diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-12-23 15:51:55 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-12-23 16:17:58 +0100 |
commit | ffcd490cb49ba86d625288ea425d98e8cac22a05 (patch) | |
tree | 342f35499da56dff6dcb4d4066818492796194ca /lisp | |
parent | 0a89ed7a962e22892e9c700cfca188197af2a6ad (diff) | |
download | emacs-ffcd490cb49ba86d625288ea425d98e8cac22a05.tar.gz emacs-ffcd490cb49ba86d625288ea425d98e8cac22a05.tar.bz2 emacs-ffcd490cb49ba86d625288ea425d98e8cac22a05.zip |
Negate only values while constraining variables (bug#45376)
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-value-negation): New
function.
* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Use
`comp-cstr-value-negation'.
* test/src/comp-test-funcs.el (comp-test-45376-1-f): Rename.
(comp-test-45376-2-f): New funcion.
* test/src/comp-tests.el (bug-45376-1): Rename test.
(bug-45376-2): Add test.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/comp-cstr.el | 14 | ||||
-rw-r--r-- | lisp/emacs-lisp/comp.el | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 92c981f5acf..8b5639c8a4d 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -701,6 +701,20 @@ DST is returned." (neg dst) (not (neg src))) dst)) +(defun comp-cstr-value-negation (dst src) + "Negate values in SRC setting the result in DST. +DST is returned." + (with-comp-cstr-accessors + (if (or (valset src) (range src)) + (setf (typeset dst) () + (valset dst) (valset src) + (range dst) (range src) + (neg dst) (not (neg src))) + (setf (typeset dst) (typeset src) + (valset dst) () + (range dst) ())) + dst)) + (defun comp-cstr-negation-make (src) "Negate SRC and return a new constraint." (comp-cstr-negation (make-comp-cstr) src)) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 485e5dc6ad2..6ed50dc0122 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2534,7 +2534,7 @@ Fold the call in case." (not ;; Prevent double negation! (unless (comp-cstr-neg (car operands)) - (comp-cstr-negation lval (car operands)))))) + (comp-cstr-value-negation lval (car operands)))))) (`(setimm ,lval ,v) (setf (comp-mvar-value lval) v)) (`(phi ,lval . ,rest) |