diff options
author | Andrea Corallo <akrl@sdf.org> | 2021-02-27 22:00:11 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2021-02-28 23:30:03 +0100 |
commit | 5bc08559e8f171eafc3c034232f8cfd9eaf89862 (patch) | |
tree | a8337beeb2bbb180603cccc754fbc52a0700ff38 /lisp/emacs-lisp/comp-cstr.el | |
parent | 2acc46b55bdf518ece6301913ffa074f31563fa4 (diff) | |
download | emacs-5bc08559e8f171eafc3c034232f8cfd9eaf89862.tar.gz emacs-5bc08559e8f171eafc3c034232f8cfd9eaf89862.tar.bz2 emacs-5bc08559e8f171eafc3c034232f8cfd9eaf89862.zip |
Don't treat '=' as simple equality emitting constraints (bug#46812)
Extend assumes allowing the following form
(assume dst (= src1 src2))
to caputure '=' semanting during fwprop handling float integer
conversions.
* lisp/emacs-lisp/comp.el (comp-equality-fun-p): Don't treat '=' as
simple equality.
(comp-arithm-cmp-fun-p, comp-negate-arithm-cmp-fun)
(comp-reverse-arithm-fun): Rename and add '=' '!='.
(comp-emit-assume, comp-add-cond-cstrs, comp-fwprop-insn): Update
for new function nameing and to handle '='.
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-=): New function.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a bunch
of '=' specific tests.
Diffstat (limited to 'lisp/emacs-lisp/comp-cstr.el')
-rw-r--r-- | lisp/emacs-lisp/comp-cstr.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 89815f03b53..bd1e04fb0bb 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -859,6 +859,18 @@ Non memoized version of `comp-cstr-intersection-no-mem'." (null (neg cstr)) (equal (typeset cstr) '(cons))))) +(defun comp-cstr-= (dst old-dst src) + "Constraint DST being = SRC." + (with-comp-cstr-accessors + (comp-cstr-intersection dst old-dst src) + (cl-loop for v in (valset dst) + when (and (floatp v) + (= v (truncate v))) + do (push (cons (truncate v) (truncate v)) (range dst))) + (cl-loop for (l . h) in (range dst) + when (eql l h) + do (push (float l) (valset dst))))) + (defun comp-cstr-> (dst old-dst src) "Constraint DST being > than SRC. SRC can be either a comp-cstr or an integer." |